Hi-Low Game
A simple guess the number game.
AI
สรุปโดย AI: 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.
ซอร์สโค้ด
// 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;
}
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine