0

My Code is not working i tried everything

#include <iostream> using namespace std; void bot(int mode,string name) { if(mode == 1) { cout << "Welcome," << name << "!" ; } else if(mode==2){ cout << "Goodbye, " << name << "!" ; } else { cout << "Try again"; } } int main() { int mode; cin >> mode; string name; cin >> name; bot(mode,name); }

28th Mar 2023, 11:47 PM
Sisanda Shwala
23 Antworten
+ 5
Sisanda Shwala please share the code coach sololution task from the lesson you are attempting. AS Brian mentioned based upon what you have share the code appears to work.
2nd Apr 2023, 4:19 AM
BroFar
BroFar - avatar
+ 2
Now I understand that this is a Code Coach task. Code Coach is unforgiving when it comes to spelling, punctuation, capitalization and spaces between words. Be sure your output matches exactly what the task says. My guess is that you need a space after the comma that follows "Welcome,". Also, maybe a period is needed after "Try again".
29th Mar 2023, 12:47 AM
Brian
Brian - avatar
+ 1
Sisanda Shwala, the code works for me. What problem are you having?
29th Mar 2023, 12:26 AM
Brian
Brian - avatar
+ 1
I see. Thanks for the help 🙏🙏
29th Mar 2023, 12:49 AM
Sisanda Shwala
+ 1
Sisanda Shwala it is not time to give up yet. Maybe we can discover some oversight. Please follow up and provide the original problem description and your latest code in Sololearn Code Playground. Posting the link to each would be best.
9th Apr 2023, 4:47 AM
Brian
Brian - avatar
+ 1
Sisanda Shwala Also, if you post your code (this time or in the future if there be any other questions) not as a plain text, but as a "code bit" and add it to your question, it will help a lot in helping you. But, if you do so, don't edit the code in question later, to not confuse the readers after the problem is solved.
9th Apr 2023, 9:25 PM
Евгений
Евгений - avatar
0
Sololearn says i have test case 4 and test case 5 issues😭
29th Mar 2023, 12:39 AM
Sisanda Shwala
0
You are welcome. I will be glad to help further if that does not solve the problem.
29th Mar 2023, 1:05 AM
Brian
Brian - avatar
0
hey Brian. im still failing to do it😭
2nd Apr 2023, 2:03 AM
Sisanda Shwala
0
I have been unable to locate this Code Coach task. Would you share a link to the task or paste the title and description here? If it is inside a tutorial, please indicate which course and lesson number.
2nd Apr 2023, 2:43 AM
Brian
Brian - avatar
0
i guess code coach is just giving me a hard time. can someone login and help😣
8th Apr 2023, 7:20 PM
Sisanda Shwala
0
Sisanda Shwala everyone here wants to help you, but in order to do that we need to see the actual task. So please tell us what is that? Name of the course, lesson number, etc.
9th Apr 2023, 7:56 PM
Евгений
Евгений - avatar
0
okay its Function Parameters, writing a program for a chatbot,assigned by Code Coach. it kept saying the test case 4 and 5 were wrong. I'd appreciate it if you could look into it.
9th Apr 2023, 8:32 PM
Sisanda Shwala
0
Sisanda Shwala In the Code Coach section I don't see anything named "Function Parameters" or with the word "chatbot" in the title. Do you mean Code Coach inside some course?
9th Apr 2023, 8:47 PM
Евгений
Евгений - avatar
0
yes its in the Introduction to C++ course
9th Apr 2023, 8:48 PM
Sisanda Shwala
0
Which section?
9th Apr 2023, 8:49 PM
Евгений
Евгений - avatar
0
Functions in=>Function Parameters
9th Apr 2023, 8:50 PM
Sisanda Shwala
0
It's inaccessible without pro subscription. I guess you need to copy-paste the text of the task here to get help (or type it by hand if it couldn't be copied).
9th Apr 2023, 8:54 PM
Евгений
Евгений - avatar
0
please check again. Function Parameters are below the Chatbot
9th Apr 2023, 8:55 PM
Sisanda Shwala
0
Sisanda Shwala I see only the "Chat Bot" practice between the "Functions" and "Function Parameters" lessons. Do you mean there's a code coach also named "Chatbot" at the end of the "Function Parameters" lesson? Anyway, I haven't completed this course yet, so I have it grayed out and can't read the task.
9th Apr 2023, 9:06 PM
Евгений
Евгений - avatar