猜数字

来源:互联网 发布:易语言iphone在线源码 编辑:程序博客网 时间:2024/06/05 17:14
#include <iostream>#include "time.h"#include "stdlib.h"int main(){    using namespace std;    int x,y;    srand((unsigned)time(NULL));    y=1+rand()%99;    cout<<"Enter a number between 0 to 100."<<endl;    for (cin>>x;x!=y;cin>>x)    {        if(x>y)      {           cout<<"error,bigger than correct!"<<endl;      }        else      {           cout<<"error,smaller than correct!"<<endl;      }    }    cout<<"correct!"<<endl;    return 0;}

0 0