for my c++ class we are writing a simon program (the game where you have to remember and follow the pattern given to you).
each turn the program outputs either r, b, g or y to the current pattern
(output should look like this:
turn1: y
2: yg
3:ygy
4:ygyr
etc.
but we are supposed to use the line cout<<"\010."<<flush; so that each letter dissapears after one second (hence the memory part of the game).
what package do i need to include so that this works properly because right now it is just outputing a period instead the the letter and replacing it with a period.
imonriddilin
0
Newbie Poster
Recommended Answers
Jump to Postyou need to use an os-specific function to delay the program a bit inside the loop. If you are using MS-Windows you can include windows.h and call Sleep function.
>>cout<<"\010."<<flush;
Thats poorly written. flush is not normally needed. Below is normally how to move the cursor back to the …
Jump to PostI don't know about the output thing you posted -- I have no idea that how to generate it. But in *nix exclude windows.h and intead of Sleep you can use the *nix version sleep or usleep
>>they are having us use PUTTY
Uggggly! That's just insane and makes …
Jump to Postwell, since I can't see the code on your monitor then you'll just have to post it here if you expect me to help you :)
All 12 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
imonriddilin
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
imonriddilin
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
imonriddilin
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
imonriddilin
0
Newbie Poster
imonriddilin
0
Newbie Poster
iamthwee
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
n.aggel
13
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.