I'm a c++ student who is very lost. I have a final program to do but I don't know when to start. If anybody can complete the program or help me out it will be highly appreciated.
Here is the assignment.
Write a program where the user guesses a number between 1-20. Have the user guess the number and tell them whether their guess is “cold” (more than 5 numbers away), “warm” (3-5 numbers away), “hot” (1-2 numbers away) or correct.
When they have successfully guessed the correct number, you should tell them how many guesses it took them and allow them to play again if they’d like.
(You may set your random number in the program, but find a way to change it if they play again – suggestion: Find a way to change your original number but keep between 1-20 by using %)
computerquip *= 2. This problem is very easy in contrast to most other final programs I've seen on this forum. That said, write out some C-like psuedo-code and work your way from there. If you can't figure that out, then there's not much we will do for you, and you should check the books. Think of it as tough love.
No. No. Solving something for someone is in direct violation of this forum's spirit. Help with syntax and minor formulation errors yes, but solving the whole problem for someone... unless you meant something else.
If this is your final one...
What did you see in your class the whole year??
I'm studying c++ on my own for about two weeks now and i can solve that...
You only need to read up to and excluding Functions (I) to solve this problem, but every section up to that point has something critical to learn that you cannot write that program without. After you read those and UNDERSTAND them, try to solve your problem again.
-Albatross
P.S.- Alternatively, I could write out a full solution for you that is going to use instances of inline assembly, several exceptions in place of basic control statements, polymorphism and virtualization within templates, a wrapper for cstdio using multiple operator overloads, several instances of recursion within the template's member functions dependent on a thrown exception, and at least one use of the void* type.
I'm a c++ student who is very lost. I have a final program to do but I don't know when to start. If anybody can complete the program or help me out it will be highly appreciated.
I assume that you are familiar with c++ since this is your final program. If you didn't tell the truth about that, which means you are a beginner, then I'll direct you to the tutorial, like Albatross did:
Write a program where the user guesses a number between 1-20. Have the user guess the number and tell them whether their guess is “cold” (more than 5 numbers away), “warm” (3-5 numbers away), “hot” (1-2 numbers away) or correct.
I would implement the guessing process as a while (or for) loop with some if (or switch) statement(s) inside to check how close the user's guess is to the target number:
When they have successfully guessed the correct number, you should tell them how many guesses it took them and allow them to play again if they’d like.
An integer initialized to zero and increased by one with every iteration inside your loop would be just fine for this one.
(You may set your random number in the program, but find a way to change it if they play again – suggestion: Find a way to change your original number but keep between 1-20 by using %)
rand(), srand() and time() would be usefull here (include cstdlib and ctime):