C语言程序设计(第三版) 第六章 实验题 2 任务3
2018-10-29 07:58
239 查看
#include <iostream>
#include<iomanip>
#include<time.h>
using namespace std;
int main()
{
int x1,x2,z,x,flag;
double i=0,a=0;
CXW:
srand(int (time(0)));
x1=rand()%10+1;
x2=rand()%10+1;
cout << x1<<"*"<<x2<<"="<<"?";
z=x1*x2;
cin >>x;
i++;
if (x==z)
{
cout <<"Right! "<<endl;
flag=0;a++;
}
else
{
cout <<"Wrong! "<<endl;
flag=0;
}
if (flag==0&&i<10)
goto CXW;
else
cout << a/i*100<<"%"<<endl;
return 0;
}
阅读更多
相关文章推荐
- C语言程序设计(第三版) 第六章 实验题 2 任务4
- C语言程序设计(第三版) 第六章 6.4
- 第六章的实验任务(1)
- 第六章实验任务(2)
- 第六章实验任务(3、4)
- 第六章实验任务(5)
- C语言程序设计(第三版) 第六章 6.14
- C语言程序设计(第三版) 第六章 6.15
- 第六章实验任务(6)
- C语言程序设计(第三版) 第六章 6.16
- C语言程序设计(第三版) 第六章 6.17
- 对第六章实验任务(6)的修正
- C语言程序设计(第三版) 第六章 6.10
- C++程序设计实验报告(四十五)---第六周任务三
- 第六周实验指导--任务五--设计一个三角形类,能够输入三角形的三个顶点,求出其面积、周长。
- 第6周实验报告任务二
- 第六周实验报告 任务三(改进)
- 实验2 Activity和Intent-任务1