c/c++ sleep()使用的同时怎么从键盘再输入数据让计算机判断(10pts)
#include<stdio.h>#include<windows.h>#include<iostream>#include<time.h>usingnamespaces...
#include <stdio.h>
#include <windows.h>
#include <iostream>
#include <time.h>
using namespace std;
#define MAX 100
int main(int argc, char* argv[])
{
int a,b;
srand( (unsigned)time( NULL ) );
for (int i=0;i<10;i++)
{
Sleep(600);
//cout<<rand()%MAX<<endl;
b=rand()%MAX;
cout<<b<<endl;
//Sleep(600);
cin>>a;
if(a!=b) exit(0);
else
continue;
//Sleep(600);
}
return 0;
}
就以上代码为例修改,谢谢~~~! 展开
#include <windows.h>
#include <iostream>
#include <time.h>
using namespace std;
#define MAX 100
int main(int argc, char* argv[])
{
int a,b;
srand( (unsigned)time( NULL ) );
for (int i=0;i<10;i++)
{
Sleep(600);
//cout<<rand()%MAX<<endl;
b=rand()%MAX;
cout<<b<<endl;
//Sleep(600);
cin>>a;
if(a!=b) exit(0);
else
continue;
//Sleep(600);
}
return 0;
}
就以上代码为例修改,谢谢~~~! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询