标签:
#include "stdafx.h"
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char* argv[])
{
int i,j,k,sum;
for(int t = 0;t<30;t++)
{
printf("第%d道题:",t+1);
i = rand()%50;
j = rand()%50;
k = rand()%4;
switch(k)
{
case 0:
sum = i+j;
printf("%d+%d=%d\n",i,j,sum);
break;
case 1:
sum = i-j;
printf("%d-%d=%d\n",i,j,sum);
break;
case 2:
sum = i*j;
printf("%d*%d=%d\n",i,j,sum);
break;
case 3:
sum = i/j;
printf("%d/%d=%d\n",i,j,sum);
break;
default:
printf("出错!\n");
break;
}
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/littlechar/p/4317919.html