I was using xcode the other day, and was working on a text-based conversation game-thingy.
#include <iostream>
int main()
{
std::cout<<"Conversation simulator requires you to type in all caps for all of your replies"<<std::endl;
std::cout<<"Type your first and last name!"<<std::endl;
std::string fname = " ";
std::string lname = " ";
bool samename = false;
std::cin>> fname >> lname ;
if (fname == "MUSCLE" and lname == "MAN")
std::cout<< "Wow, we have the same first and last name!"<<std::endl;
samename = true;
else
std::cout<< fname << " "<< lname << "is a very nice name"<<std::endl;
return 0;
}
nothing seems quite wrong to me, but Xcode won't run because on this line:
else
it expected an expression? I can't think of what that might mean.
Aucun commentaire:
Enregistrer un commentaire