这个程序哪错了,为什么没有输出啊
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int question(void);
float answer(int result,int rand1,int rand2);
void rAnswer(void);
void wAnswer(void);
void rateFunction(float);
static int rand1,rand2;
static int wcount=0,rcount=0;
int main()
{
srand((int)time(0));
do{
int question(void);
float answer(int result,int rand1,int rand2);
void rateFunction(float rate);
}while(rcount+wcount==15);
return 0;
}
int question()
{
int result;
rand1=1+(int)(rand()%10);
rand2=1+(int)(rand()%10);
printf("How much is %d times %d",rand1,rand2);
scanf("%d",&result);
printf("%d",result);
return (result);
}
float answer(int result,int rand1,int rand2)
{
float rate;
if (result==rand1*rand2)
{void rAnswer();
rcount++;
}
else
{void wAnswer();
wcount++;
}
rate=rcount/(rcount+wcount);
return rate;
}
void rAnswer(void)
{ int rRand;
rRand=1+rand()%4;
switch(rRand)
{
case 1:printf("Very good!\n");break;
case 2:printf("Excellent!\n");break;
case 3:printf("Nice work!\n");break;
case 4:printf("Keep up the good work!\n");break;
}
}
void wAnswer(void)
{ int wRand;
wRand=1+rand()%4;
switch(wRand)
{
case 1:printf("No.pelase try again.\n");break;
case 2:printf("Wrong.Try once more.\n");break;
case 3:printf("Don't giue up!\n");break;
case 4:printf("No,keep trying.\n");break;
}
}
void rateFunction(float rate)
{ if (rate<=0.75)
{
printf("Please ask your instruyctor for extra help");
exit(0);
}
}
[此贴子已经被作者于2007-4-12 18:00:32编辑过]