四则运算

#include <stdlib.h>
#include <stdio.h>
#include<time.h>
int main(void)
{
int n=0,i,j,k,d=0,q,w,e,r;
char *a[6]={"+","-","*","/","(",")"};
printf("开始生成\n");
printf("产生题数:");
scanf("%d",&n);
srand(time(NULL));
do{
i=rand() % 4;
j=rand() % 4;
k=rand() % 4;
q=rand() % 100;
w=rand() % 100;
e=rand() % 100;
r=rand() % 100;
printf("%d%s%d%s%d%s%d=\n", q,a[i],w,a[j],e,a[k],r);
d++;
}while(d!=n);
return 0;
}


实现功能:随机种子,每次生成不一样的数字;加减乘除运算;用户需要的题数;
未实现动能:加括号;
本次实验花时大概一个小时左右,本可以半小时搞定,经过修改,测试,修改。。。最终用了一个多小时,还有功能没法完成。需要再进一步思考。。。

原文地址:https://www.cnblogs.com/hewupeng/p/4368687.html