软件工程(个人项目一)
实验思路:
1、寻找随机数,并可以出现多个不同的数
2、使用循环语句,保证30道题的数目
3、保证四则运算符号的正确性“+、-、*、/”
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char **argv)
{
int a[30],b[30];
int i,c,d;
srand((unsigned int)time(NULL));
for (i = 0; i < 30; i++)
{
a[i] = rand()%101;
b[i] = rand()%101;
printf("%d......%d+%d=\n", i+1,a[i],b[i]);
}
printf("按任意键查看答案");
getchar();
for (i = 0; i < 30; i++)
{
printf("%d......%d+%d=%d\n", i+1,a[i],b[i],a[i]+b[i]);
}
getchar();
return 0;
}
#include <string.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char **argv)
{
int a[30],b[30];
int i,c,d;
srand((unsigned int)time(NULL));
for (i = 0; i < 30; i++)
{
a[i] = rand()%101;
b[i] = rand()%101;
printf("%d......%d+%d=\n", i+1,a[i],b[i]);
}
printf("按任意键查看答案");
getchar();
for (i = 0; i < 30; i++)
{
printf("%d......%d+%d=%d\n", i+1,a[i],b[i],a[i]+b[i]);
}
getchar();
return 0;
}
”
posted on 2018-10-07 21:18 🌚🌚🌚🌝🌝 阅读(272) 评论(0) 编辑 收藏 举报