+ 3

everything was going fine

well this is one of my first simple rpg codes , and everything was smoothly until it started giving me error in my cout and cins ... can you guys give me any hints on this code i made ??? i cant compile it anymore ! #include<iostream> #include<string> using namespace std; int main() { string name; string option; //HUD cout << "================================" << endl; cout << " WELCOME TO ------ " << endl; cout << "================================" << endl; cout << "you are a young knight named :" ; getline (cin,name); cout << "as " << name << " aproaches into the dence forest , funny sounds are echoing in the trees..."<<endl; cout << ""<< name << " hears the sound coming closer"<<endl; cout << "Type the action your character will take on your journey !"<<endl<<endl; cout << "1)investigate 2)momentum"<<endl; cin >> option ; if(option=="investigate"){ cout << "ALL OF A SUDDEN "<<endl<<endl; cout << "An ORC appeared ! " << endl; goto battle; } else if (option=="momentum"){ cout << "you are prepared with your blade close to you (+2 attack bonus !)"<<endl<<endl; } else cout<< "please enter a valid command from the 2 given"<<endl; } battle: cout << "Choose between 3 commands so you can take fast actions" <<endl<<endl; cout << "1) Fight 2) Block 3) Run" << endl; cin >> option ; if(option == "fight"){ cout<<"as you swing your weapon at the orc you manage to wound it deadly"<<endl<<endl; cout<<"you managed to kill the orc"<<endl; cout<<"you found 34 gold ! " <<endl; } else if(option == "block"){ cout<<"the orc tries to attack you but you block it really quick!"<<endl; goto battle; } else if(option == "run"){ cout<<"you flee in fear !"<<endl; cout<<"what a coward ..."<<endl; } else{ cout<<"please enter a valid command from the 3 given options !"<<endl; goto battle; } return 0 ; }

3rd May 2018, 12:04 AM
Dichonia
Dichonia - avatar
4 Respostas
+ 3
Can you provide the compiler output? What was the last thing you did before it broke. It would also be helpful to include a link to this in the Code Playground.
3rd May 2018, 12:58 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 1
Always put code in the code playground. That way we can play with it directly and see what's up.
3rd May 2018, 4:08 AM
Adam
Adam - avatar
+ 1
You had an extra curly bracket. https://code.sololearn.com/cV9I31pM3Hdg/#cpp
3rd May 2018, 6:04 AM
Hanz
Hanz - avatar
0
indeed i had extra bracket left unnoticed ! thank you all for the replies ill provide with the compiler output next time ! :)
3rd May 2018, 12:34 PM
Dichonia
Dichonia - avatar