Mansoor8
December 3rd, 2004, 02:35 PM
Good Day:
I am working on a coding project and have come to an area where the logic does respond correctly; this is normal, of course, but even when I manipulate and alter this snippet in every way I know how, I only get a different error. I appreciate if some one could take the time to view and analyze this bit and offer their opinion. If there is anything you might need to know concerning the whole, overall code to this project please ask me here.
(*also, I am easily confused by curly-brace use for functions, and now I have read while researching the topic that curly-brackets are optional in many cases: how can this be and what is the truth for their implementation in C++ code work?)
cout<< "Would you like to play a game?\n"<< endl;
cin.getline(string, 256, '\n');
std::string::size_type idx3;//--VAR
idx3 = name.find("sure");
idx3 = name.find("no");
std::string::size_type idx4;//--VAR???????
idx3 = name.find("abcdeghijklmqrtuvwxyz");//---??????????
cout<< "\n"<< endl; //-- Spacer
if(idx3 !=string::npos ) //--works
cout<< "Oh boy, what fun!\n"<< endl;
else if(idx3 !=string::npos ) //--works
cout<< "Why not?\n"<< endl;
else if (idx4 !=string::npos ) //--works
cout<< "Fine.\n"<< endl;
Thank-you so much...
Mansoor
I am working on a coding project and have come to an area where the logic does respond correctly; this is normal, of course, but even when I manipulate and alter this snippet in every way I know how, I only get a different error. I appreciate if some one could take the time to view and analyze this bit and offer their opinion. If there is anything you might need to know concerning the whole, overall code to this project please ask me here.
(*also, I am easily confused by curly-brace use for functions, and now I have read while researching the topic that curly-brackets are optional in many cases: how can this be and what is the truth for their implementation in C++ code work?)
cout<< "Would you like to play a game?\n"<< endl;
cin.getline(string, 256, '\n');
std::string::size_type idx3;//--VAR
idx3 = name.find("sure");
idx3 = name.find("no");
std::string::size_type idx4;//--VAR???????
idx3 = name.find("abcdeghijklmqrtuvwxyz");//---??????????
cout<< "\n"<< endl; //-- Spacer
if(idx3 !=string::npos ) //--works
cout<< "Oh boy, what fun!\n"<< endl;
else if(idx3 !=string::npos ) //--works
cout<< "Why not?\n"<< endl;
else if (idx4 !=string::npos ) //--works
cout<< "Fine.\n"<< endl;
Thank-you so much...
Mansoor