C语言编程——100以内的整数四则运算测试程序设计

100以内的整数四则运算测试程序设计
要求如下:
(1)选项菜单集成各功能函数模块
(2)出题(每次出10道题目)
(3)答题并评分
(4)答错的题给出正确答案
(5)显示答卷

拜托各位大侠了!!

完美!请看我的作品:

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <conio.h>

#define N 10
typedef struct _ti {
int a, b;
int op;
int result;
int input;
int rw;
}ti;

ti timu[N];
int fen;
int flag;

int mulu()
{
int s;
while(1) {
printf("\t\t欢迎进入super考试系统\n\n");
printf("1)随机出题\t\t\t\t");
printf("2)开始考试\n");
printf("3)试卷评分\t\t\t\t");
printf("4)显示批改的试卷\n");
printf("5)退出系统\n\n");
printf("请做出选择:");

scanf("%d", &s);
while(getchar() != '\n');

if(s < 1 || s > 5)
printf("选择有误!请重新输入.\n");
else
break;
}
return s;
}

void chuti()
{
int i, f;
printf("确认随机出%d道题吗?(y确认):", N);
if(getchar() != 'y')
return;

for(i = 0, f = 1; i < N; f ? i++ : 0) {
timu[i].a = rand() % 100+1;
timu[i].b = rand() % 100+1;
timu[i].op = rand() % 4;
if(timu[i].b == 0 && timu[i].op == 3) {
f = 0;
continue;
}
else
f = 1;
switch(timu[i].op) {
case 0: timu[i].result = timu[i].a + timu[i].b;break;
case 1: timu[i].result = timu[i].a - timu[i].b;break;
case 2: timu[i].result = timu[i].a * timu[i].b;break;
case 3: timu[i].result = timu[i].a / timu[i].b;break;
}
}
printf("出题完毕!\n");
flag = 1;
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-07-15
太简单了,懒得答。回去看书吧
第2个回答  2013-07-15
是随机出题吗?