+ 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); }
6 Antworten
+ 4
You are missing open brace for main function..
int main() { 👈 John Nderi
Add task description....
What other errors you can see?
+ 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)
+ 1
What purpose of this program
+ 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.
+ 1
Int main () { .