/*10以内的随机四则运算*/
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
main( )
{
char ops[]={'+','-','*','/'};
int x,y,ans;char op;
srand(time(NULL));/*不必深究其意*/
do
{
op=ops[rand()%4];
x = rand() % 10;
y = rand() % 10;
if(op=='-'&& x<y)
{ int t=x;x=y;y=t; }
while(op=='/'&&y==0)
{ y = rand() % 10; }
if(op=='/')x*=y;
printf("%d%c%d=?\n",x,op,y);
scanf("%d",&ans);
//以下请楼主自行编制下去吧...
}
while(ans>=0);
}