Will compile on visual studios 2010...here is the link for C++ http://www.cramst
ID: 3625631 • Letter: W
Question
Will compile on visual studios 2010...here is the link for C++http://www.cramster.com/answers-feb-11/computer-science/guessing-game-rate-life-saver-compile-visual-studios-2010eac_1157392.aspx
Each funcion must have it's own function heading and prototype. Then there will be a function call in main. The idea is the program is suppose to be structured so that if you need to change one function it will be easier to do. Thanks.
Write a program that plays a number guessing game with the user. A sample run of the game program would be as follows(user input is in bold face:
Welcome to that game of guess it!
I will choose a number between 1 and 100.
You will try to guess that number. If you guess wrong I will tell you if you guessed to high or to low.
You will have 6 tries to guess the number.
OK, I am thinking of a number. Try to guess it.
Your Guess? 50
Too high!
Your guess? 12
Too low!
Your guess? 112
Illegal guess. Your guess must be between 1 and 100.
Try again. Your guess? -20
Illegal guess. Your guess must be between 1 and 100.
Try again. Your guess? 23
***Correct*****
Want to play again? y
Ok, I am thinking of a number. Try to guess it.
Your guess? 85
Too high!
Your guess? 12
Too low!
Your guess? 57
***Correct*****
Want to play again? N
Goodbye, it was fun.
Hope to play Guess it with you again soon.
....................................................................................................................................
Hint: Look up the library functions rand() and srand(). Use them to establish the number to be guessed so that the number will be different each time the game is played.
Explanation / Answer
this is done in c++ but it compiles on Vis Studio 2010, i just tried it. I write alot of C code and it always compiles and works fine. to change it to C you need to change the declarations (# include) and the cout and cin to printf and scanf statements. I am not sure exactly sure what you are looking for but I hope this helps if not let me know. If you are looking for the functions also let me know. #include #include #include using namespace std; void directions(); int think(); int getGuess(); bool checkGuess(int,int); bool playagain(); void lostmessage(int); void exit(); int main() {srand(time(0)); int guess,num,tries; bool good,again; directions(); do {num=think(); tries=0; good=false; again=false; do { guess=getGuess(); good=checkGuess(num,guess); tries++; }while(!good&&triesRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.