+ 2

Can someone please help me out here. This code keeps giving me errors despite the fact that it's correct I think ?

#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; string name; cin >> mode; cin >> name; bot(mode, name); }

8th May 2023, 6:20 PM
MJNderi coDER
MJNderi coDER - avatar
5 odpowiedzi
+ 4
You are missing open brace for main function.. int main() { 👈 John Nderi Add task description.... What other errors you can see?
8th May 2023, 6:26 PM
Jayakrishna 🇮🇳
+ 2
you probably just need to add spaces after the commas, so it outputs eg "Welcome, name!" instead of "Welcome,name!" (assuming you get that opening { sorted out like Jayakrishna 🇮🇳 mentioned)
8th May 2023, 7:11 PM
Orin Cook
Orin Cook - avatar
+ 1
What purpose of this program
8th May 2023, 6:28 PM
Tohan
Tohan - avatar
+ 1
BlunderKing Pls avoid giving finished code as answer, because it makes the OP skip the most important part of learning. Prefer giving hints for the OP to find the solution instead.
9th May 2023, 12:55 AM
Emerson Prado
Emerson Prado - avatar
+ 1
Int main () { .
9th May 2023, 9:06 AM
Abdul Samad