您的位置:首页 > 编程语言 > C语言/C++

C语言程序设计(第三版) 第六章 实验题 2 任务1

2018-10-28 22:20 176 查看

#include <iostream>
#include<time.h>
using namespace std;

int main()
{
    int x1,x2,z,x,flag;
CXW:
    srand(int (time(0)));
    x1=rand()%10+1;
    x2=rand()%10+1;
    cout << x1<<"*"<<x2<<"="<<"?";
    z=x1*x2;
    cin >>x;
    if (x==z)
    {
        cout <<"Right!"<<endl;
        flag=0;
    }
    else
    {
        cout <<"Wrong! Please try again."<<endl;
        flag=0;
    }
    if (flag==0)
        goto CXW;
    return 0;
}
 

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: