this should be pretty basic. I can open a window but once i hit enter nothing else happens. for like tictactoe what can i do for it to keep happening.
so far my code is:
#include %26lt;iostream%26gt;
using namespace std;
int main (int argc, char *argv[])
{
cout %26lt;%26lt; "Message!" %26lt;%26lt; endl;
cout %26lt;%26lt; "Press ENTER to continue..." %26lt;%26lt; endl;
cin.get();
return 0;
}
What can i do to make this more interesting?
C++ help. should be easy?
// try this out
#include %26lt;iostream%26gt;
using namespace std;
int main (int argc, char *argv[])
{
bool bLoop = true;
char letter;
while(bLoop)
{
cout %26lt;%26lt; "Message!" %26lt;%26lt; endl;
cout %26lt;%26lt; "enter a letter(X to exit)..." %26lt;%26lt; endl;
cin%26gt;%26gt;letter;
if( letter == 'X') bLoop = false;
}
return 0;
}
Reply:Well for tic tac toe you could draw the board with text, like
__|__|__
__|__|__
....|.....|
Just pretend the dots are spaces. Then input from the user where they want to put the x and redraw with the user and computer choice. What would make it interesting for you is the computer having to "think" where to put its O. Unless you want to toggle between two users which would be a lot simpler to do.
email cards
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment