Archived

This topic is now archived and is closed to further replies.

Problem with if

This topic is 5791 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay,I am having a problem ending this if statement.My complier puts whatever is after my if statement in the statement.Heres the code: if (ank == 7) std::cout<<"_X_|___|___\n"; std::cout<<"___|___|___\n"; std::cout<<"___|___|___\n"; std::cout<<" | |\n"; so how do i end it?

Share this post


Link to post
Share on other sites
Remember that cout, cin, fstream, ofstream, ... are all subclasses of iostream/iobase (or something like that anyway). so most funcs can be used accross the board and will achive similar results.

this is foolproof and if it doesn't work check your compiler settings (i'll be assuming that you're in std namespace 'using namespace std;' for simplicity):

if (ank == 7) {
cout << "_X_|___|___\n";
cout << "___|___|___\n";
cout << "___|___|___\n";
cout << " | |\n";
}
or you could take a small shortcut:

if (ank == 7) {
cout << "_X_|___|___\n"
<< "___|___|___\n"
<< "___|___|___\n"
<< " | |"
<< endl;
}

Edited by - Krysole on February 2, 2002 11:27:20 PM

Share this post


Link to post
Share on other sites