How should I create this while loop?

I already have a program that will generate random numbers and i already have a variable that generates random numbers between 1-100, which i named oracle. My program needs to ask the user for a number between 1-100, and then get a random number from the oracle and the loop needs to end once the oracle guesses the users number. After the oracle guesses the correct number, the program needs to print out the number of tries it took the oracle to guess my number. However, my program has to get a number from the oracle in a while loop and end when the oracle guesses my number and this is where i don't know what to do. I haven't learned much about while loops from this book but i want to finish this program.
This is what i have so far, i know lines 15 and 16 have to be in a while loop somehow along with more information.



4 #include <iostream>
5 using namespace std;
6 #include "Random.h"
7
8 int main()
9 {
10 int variable;
11
12 cout << "What is your secret number between 1 and 100?" << endl;
13 cin >> variable;
14
15 Random oracle(1,100);
16 cout << oracle.get() << endl;
17
18 }
19
1
2
3
4
5
6
7
8
9
10

bool bGuessed = false;

do{

//bGuessed is true if the values match
...

}while(bGuessed == false);
Topic archived. No new replies allowed.