// Inlcudes
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <ctime>
#include <cstdlib>
usingnamespace std;
// Main Function
int main()
{
srand ((unsignedint) time(NULL));
int num;
int num2 = 1 + rand() % 100;
cout << "This program is a random guessing game.\n\n";
do
{
cout << "Enter your guess (1-100): ";
cin >> num;
if ( num < num2 )
{
cout << "Too Low, Try Again." << endl;
}
elseif ( num > num2 )
{
cout << "Too High, Try Again" << endl;
}
elseif ( num == num2 )
{
cout << "Congratulations, You Figured Out My Number." << endl;
}
} while ( num = num2 );
_getch();
return 0;
}
Im using a do while only because i feel more comfortable with it in this program, but my problem is it keeps running even after the user has entered the correct number, i need it to stop after the correct number has been entered. Does anyone see the problem.