用C语言编程随机产生10道包含加减乘除的数学题,输入答案之后能够返回答案是否正确,10道题完成的时候能够得到错误几道正确几道并且从屏幕输出
// c_rand_num_add.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include
#include
#include "iostream"
using namespace std;
#define BIG_NUM 10 //最大的整数
#define TITLE_NUM 10
int right_num;
void rand_num(int *a, int *b){
*a=abs(rand()%BIG_NUM);
*b=abs(rand()%BIG_NUM);
}
int rand_rule(){
/* 0=> +
1=> -
2=> *
3=> /
*/
int way;
way=abs(rand()%4);
return way;
}
void out(int a,int b,int rule){
int c;
switch(rule)
{
case 0:{
cout<
cin>>c;
if (c==(a+b))
right_num++;
break;
}
case 1:{
cout<

被折叠的 条评论
为什么被折叠?



