Advertisement
1_2002 Games #111277

Hi-Low Game

A simple guess the number game.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
// Hi-Low Program	David Javaheri	2-8-99
#include <stdlib.h>
#include <iostream.h>
#include <time.h>
main()
{
int	num, guess;
srand( (unsigned) time(NULL) ); //Seeds rand()
num=(rand()%100)+1;
cout<<"Guess a number between 1 and 100"<<endl;
cin>>guess;
while(guess!=num)
{
	if(guess<num)
	{
		cout<<"Too Low. Try Again"<<endl;
		cin>>guess;
	}
	
	if(guess>num)
	{
		cout<<"Too High. Try Again"<<endl;
		cin>>guess;
	}
}
	
if(guess==num)
{
	cout<<"You Are Correct"<<endl;
}
return 0;
}
Original Comments (3)
Recovered from Wayback Machine