功能
用到的觀念
rand while
CODE
#include<iostream>//標頭檔
#include<iomanip>
#include<cmath>
using namespace std;
using std::setw;
using std::fixed;
using std::uppercase;
using std::setprecision;
using std::getline;
#include<ctime>
using std::rand;
using std::srand;
int main()
{
srand(time(0));
int a,b=rand()%1000,input;
do
{
cin>>a;
if(a>b)
cout<<"too high"<<endl;
if(a<b)
cout<<"too low"<<endl;
}while(a!=b);
cout<<"right";
system("pause");
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.7.59