i have been writing a dungeon crawler type game and have encountered a problem,
in the code below this i use an if statement stating that if the user is to type library Library The library or the library it is to continue but anything else to skip the following code.However it seems that no matter what i type in it always progresses on to the next code when in fact i want it to skip on, any help would be much appreciated thanks
string name;
string gender;
bool gotgoal = true;
string goal;
string travel;
int q1;
int q2;
int q3;
int q4;
while(gotgoal){
cout << "you find yourself standing in the middle of a village\n Where do you wish to travel?\nthe library\nthe general store\nthe postoffice\nthe music store\nthe church\nthe restaurant \n";
getline(cin, travel);
if(travel == "library"||"The library"||"Library"||"the library"){//library
cout<<"you walk into the library and are immediatly greeted by the librarian\n1)do you have any books on "<< goal << "?" <<"\n"<<"2)do you know where i can find "<< goal <<"?\n";
cin>> q1;//first library question
if( q1 == 1 ){//do you have any books on...
cout<<"Not at the moment sorry, I can order one in if you want?\n1)sure\n2)no thanks\n";
cin>> q2;
if(q2 == 1){//order book
cout<<"No problem I'll contact you when it arrives\n";
sleep(1000);
cout<<"book ordered!\n";
sleep(500);
}
elseif(q2 == 2){//dont order book
cout<<"ok nevermind\n";
}
}
elseif( q1 == 2 ){
cout<<"err I think i heard the general store owner talking about that the other day why dont you talk to him\n";
}
travel = "defualt";
}//library end
elseif(travel == "store"){
cout<<"you walk into the store\n1)Ask for manager\n2)look for "<< goal << " on shelf";
}
elseif(travel == "life"){
cout<<"you walk into the store\n1)Ask for manager\n2)look for "<< goal << " on shelf";
}
}//while end
if(travel == "library"||"The library"||"Library"||"the library"){//library
Should be replaced by: if (travel == "library" || travel == "The library" || travel == "Library" //and so on