你猜我猜不猜?你猜?

//code

#include

#include

using namespace std;

void main(void)

{

system("cls");

srand((unsigned)time(NULL)); 

int m=0 + rand() % 100;

int input;

int max=0;

cout<<"**************猜数游戏**************"<<endl;

cout<<"*  电脑随产生一个1-100之间的随机数  *"<<endl;

cout<<"*  猜错重新输入数字       猜对退出  *"<<endl;

cout<<"***********你猜我猜不猜你猜**********"<<endl;

do

{

max++;

cout<<max<<"你猜:"&&cin>>input;

if(input>m)

cout<<"你输入的数字太大了!";

else if(input

cout<<"你输入的数字太小了!";

else

cout<<"恭喜你答对了";

cout<<endl;

 

}

while(input!=m);

system("pause");

}

C++学习笔记 -猜数字游戏

相关文章: