遇到问题了....
要求编写一个小学数学出题系统,之前都编写好了...可是要求写到要有题目存储功能...然后就不会了,这个不会啊,有人能帮我一下么?#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#define r100 rand()%NN
#define r4 rand()%4
#define r50 rand()%(NN/2)
int main()
{
int a,b,c,i,j,aa[25]={1};
int ans,s,k=0,hour,mini,sec,NN,MM;
double score=0.0;
clock_t start,end;
char ch[4][4]={"+","-","×","÷"},ag;
srand((unsigned)time(NULL));
for(i=1;i<6;i++)printf("\n");
printf(" ####################################################################\n");
printf(" ####******************适用于小学3年级以下***********************####\n");
printf(" ####********************Ready, Go,Go,Go!***********************####\n");
printf(" ####***好好学习****小学数学(+ - * /)练习系统!***天天向上*****####\n");
printf(" ####****************************Day Day Up!*********************####\n");
printf(" ####################################################################\n");
system("pause");
begin: k=0;score=0;
printf("请输入测验数字大小范围(100表示100以内):");
scanf("%d",&NN);
printf("\n");
printf("请输入测验题目数量:");
scanf("%d",&MM);
printf(">>>>>>>>>>>>>>你将要进行%d以内测验,题数:%d题!<<<<<<<<<<<<<<<<<<<<<<\n",NN,MM);
system("pause");
system("cls");
for(i=1;i<6;i++)printf("\n");
printf(" ####################################################################\n");
printf(" ####*************************准备好了么??*********************####\n");
printf(" ####************************Ready, Go,Go,Go!*******************####\n");
printf(" ####********好好学习*********Good good Study!*****天天向上*****####\n");
printf(" ####****************************Day Day Up!*********************####\n");
printf(" ##################################开始啦!##########################\n");
system("pause");
start=clock();
do {
k++;
a=r100;
b=r100;
c=r4;
if(3==c)
{ aa[1]=a;
for(i=2,j=2;i<=a/2;i++)
if(a%i==0){aa[j]=i;j++;}
do b=aa[rand()%j];
while(b==0);
}
if(1==c)b=rand()%a;
if(2==c){a=r50;b=rand()%(NN/a);}
if(0==c)b=rand()%(NN-a);
switch(c){
case 0:s=a+b;break;
case 1:s=a-b;break;
case 2:s=a*b;break;
case 3:s=a/b;break;
}
printf("(%d). %d %s %d =",k,a,ch[c],b);
scanf("%d",&ans);
if(ans==s)printf("(√)得分:%.2f\n",score+=100.0/MM);
else printf("(×)正确答案为:%d\n得分:%.2f\n",s,score);
}
while(k<MM);
end=clock();
hour=0;
mini=0;
sec=(end-start)/1000;
if(sec>59)
{
if(sec>=3600){hour=sec/3600;mini=(sec-hour*3600)/60;sec=sec%60;}
else {hour=0;mini=sec/60;sec=sec%60;}
}
printf("总用时:%d小时%d分%d秒\n总得分:%.2f\n",hour,mini,sec,score);
if(score-60.0<0){
printf("你很聪明,不过基础太差,你还需要努力噢,加油!加油!加油!");
printf("不服,再来一遍?(Y/N):") ;
fflush(stdin);
ag=getchar();
if(ag=='Y'||ag=='y')goto begin;
}
system("pause");
fflush(stdin);
printf("是否再来一遍?(Y/N):");
ag=getchar();
if(ag=='Y'||ag=='y')goto begin;
return 0;
}