全部博文(149)
分类: C/C++
2007-03-21 17:03:10
/*
* This source file is written by Zhang Hao.
* This file is programmed in VC++ 6.0.
* This is a game that let user to guess an integer between 1 and 100.
* Best wishes for everyone.
*/
#include "stdafx.h"
#include
#include
#include
#include
int main(int argc, char* argv[])
{
int index ,temp, qq;
// Initialize the random system.
temp=unsigned(time(NULL));
srand(temp) ;
index = 100*rand()/RAND_MAX;
index = 100*rand()/RAND_MAX;
cout<
{
cout<<"This is your "< cin>>qq;
if(qq==index)
{
cout<<"You succeed!"<
}
else if(qq>index)
cout<<"Your number inputed is larger!"<
cout<<"Your number inputed is smaller!"<
cin>>qq;
return 0;
}