1 #include<iostream> 2 #include<stdlib.h> 3 #include"time.h" 4 using namespace std; 5 void main() 6 { 7 int a, b, i, j, k; 8 for (i = 0; i < 30; i++) 9 { 10 a = rand() % 10; 11 b = rand() % 10; 12 if (a < b) 13 { 14 k = a; 15 a = b; 16 b = k; 17 } 18 cout << a; 19 j = rand() % 4; 20 switch (j) 21 { 22 case 0:cout << '+'; break; 23 case 1:cout << '- '; break; 24 case 2:cout << '*'; break; 25 case 3:cout << '/'; break; 26 27 } 28 29 if (j % 4 == 3) 30 b++; 31 cout << b << "=" << endl; 32 } 33 }