I am new to c++, and i use Codeblocks as IDE. I get these two errors "expected unqualifed-id before 'if'" and "expected unqualifed-id before 'else'". I searched around a lot and gotten nothing. My goal is for the story to progress after the users choices so they choose the genre and get a specific story. I am open for any critics because i only want to get better.
#include <iostream>
using namespace std;
void Story(){
char genre;
cout << "Hello!" << endl;
cout << "I will now tell you a story that will change according to your
choices" << endl;
cout << "Beware!" << endl;
cout << "" << endl;
cout << "Lets start the story" << endl;
cout << "Your first choice is the genre" << endl;
cout << "Adventure or Post Apocalypse: " << endl;
cout << "If you want Adventure type A or P for Post Apocalypse: " << endl;
cin >> genre;
}
if(genre == 'A'){
Adventure();
}
else if(genre == 'P'){
PostApocalypse();
}
string Adventure(){
cout << "Adventure" << endl;
return 0;
}
string PostApocalypse() {
cout << "Post Apocalypse" << endl;
return 0;
}
int main(){
Story();
return 0;
}
Thanks in advance and sorry for my bad english
Aucun commentaire:
Enregistrer un commentaire