I cant quite get this to work my output is always isnt beer the best
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
void IfBeverage (){
string drink;
cout << "What do you want to drink?\n" << "beer\n" << "whiskey\n" << "bleach\n"
<< "or boiling water" << endl;
getline (cin,drink);
if (drink == "beer" || "Beer"){
cout << "isnt beer the best" << endl;
}elseif (drink == "whiskey" || "Whiskey"){
cout << "That will get you going" << endl;
}elseif (drink == "bleach" || "Bleach"){
cout << "This may kill ya but go for it" << endl;
}elseif (drink == "boiling water" || "Boiling water"){
cout << "I could have gave you a blanket if you were cold" << endl;
}else {
cout << "I hope you die of herpes and rot in hell" << endl;
}
}
void IfBeverage() {
std::string drink;
std::cout << "What do you want to drink?\n" << "beer\n" << "whiskey\n" << "bleach\n"
<< "or boiling water\n" ;
std::getline ( std::cin, drink );
if ( drink == "beer" || drink =="Beer" )
std::cout << "isnt beer the best\n" ;
elseif ( drink == "whiskey" || drink =="Whiskey")
std::cout << "That will get you going\n" ;
elseif ( drink == "bleach" || drink =="Bleach" )
std::cout << "This may kill ya but go for it\n" ;
elseif ( drink == "boiling water" || drink =="Boiling water")
std::cout << "I could have gave you a blanket if you were cold\n" ;
else
std::cout << "I hope you die of herpes and rot in hell\n" ;
}
or
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
void IfBeverage() {
std::string drink;
std::cout << "What do you want to drink?\n" << "beer\n" << "whiskey\n" << "bleach\n"
<< "or boiling water\n" ;
std::getline ( std::cin, drink );
if( !drink.empty() ) drink.front() = std::tolower( drink.front() ) ; // #include <cctype>if ( drink == "beer" ) std::cout << "isnt beer the best\n" ;
elseif ( drink == "whiskey" ) std::cout << "That will get you going\n" ;
elseif ( drink == "bleach" ) std::cout << "This may kill ya but go for it\n" ;
elseif ( drink == "boiling water" ) std::cout << "I could have gave you a blanket if you were cold\n" ;
else std::cout << "I hope you die of herpes and rot in hell\n" ;
}
void IfBeverage (){
string drink;
cout << "What do you want to drink?\n" << "beer\n" << "whiskey\n" << "bleach\n"
<< "or boiling water" << endl;
getline (cin,drink);
if (drink == "beer" ||drink == "Beer"){
cout << "isnt beer the best" << endl;
}
elseif (drink == "whiskey" || drink == "Whiskey"){
cout << "That will get you going" << endl;
}
elseif (drink == "bleach" || drink == "Bleach"){
cout << "This may kill ya but go for it" << endl;
}
elseif (drink == "boiling water" || drink == "Boiling water"){
cout << "I could have gave you a blanket if you were cold" << endl;
}
else {
cout << "I hope you die of herpes and rot in hell" << endl;
}
}