--Originally published at Solving Problems with Programming
Link of the picture: Link of the picture
So in this sixth class that I had on last Monday I started how to make a program with loops in C++.#Mastery13
What I did for this numeric program is solving the problem to the user by writing a program that picks a random integer in the range of 1 to 100.
There are different ways to make that happen , I chose one method that best works for me.
After that, inside the program prompts the user for a guess of the value, with hints of ‘too high’ or ‘too low’ from the program.
The program continues to run until the user guesses the integer. I did something extra here including telling the user how many guesses the user had to make to get the right answer.
I checked that my program doesn’t always use the same random number chosen by splitting my problem solving into parts.
At first I only generated the random number and printed that as a first step.
The following photograph shows the solution to this problem:
Picture of the author.
So at first I wrote the same structure of the program just did the same as what i did in Hello World: Second Class, Second Blog (Blog of the second class 12/01/17) and Hello World.cpp, #WSQ01 Post Fun with Numbers 16/01/17 and WSQ1.cpp and #WSQ02 Post Temperature 23/01/17 and WSQ02.cpp where i explained the application of the #MasteryTopic01 that it is for comments that could be very useful when debugging and #MasteryTopic04 that is basic output for data. Also I did some other mastery topics.
What i first put in the code was the library <iostream> to call all the fuctions of inputs and outputs of data in languague C++ #MasteryTopic06 Calling Functions and #MasteryTopic08
Continue reading "#WSQ03 Post Pick a Number 23/01/17 and WSQ03.cpp" →