简单的四则运算
1 #include<stdio.h> 2 #include<cstdlib> 3 #include<iostream> 4 #include<ctime> 5 using namespace std; 6 int random(int Max) 7 { 8 return rand()%Max; 9 } 10 int main() 11 { 12 char sign[4]={'+','-','*','/'}; 13 int n=300; 14 while(n--) 15 { 16 17 printf("%d %c %d %c %d %c %d %c %d =\n", 18 random(100),sign[random(4)],random(100),sign[random(4)], 19 random(100),sign[random(4)],random(100),sign[random(4)], 20 random(100) 21 ); 22 } 23 return 0; 24 25 }