fork download
  1. #include <iostream>
  2. #include <fstream>
  3. #include <ctime>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7.  
  8. const char duom[] = "U1.txt";
  9. const char rez[] = "U1_rez.txt";
  10.  
  11. void num_gen(int & x, int & y);
  12.  
  13. int main(){
  14. srand(time(NULL));
  15.  
  16. int x, y;
  17.  
  18.  
  19. for(int j = 1; j <= 4; j++){
  20. num_gen(x, y);
  21. cout << x << " + " << y << " = "<< x + y << endl;
  22. cout << x << " - " << y << " = "<< x - y << endl;
  23. cout << x << " * " << y << " = "<< x * y << endl;
  24. cout << x << " / " << y << " = "<< x / y << endl;
  25. cout << "************" << endl;
  26. }
  27.  
  28. return 0;
  29. }
  30.  
  31. void num_gen(int & x, int & y){
  32. x = 3 + (rand() % 10);
  33. y = 3 + (rand() % 10);
  34. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
10 + 12 = 22
10 - 12 = -2
10 * 12 = 120
10 / 12 = 0
************
12 + 6 = 18
12 - 6 = 6
12 * 6 = 72
12 / 6 = 2
************
8 + 9 = 17
8 - 9 = -1
8 * 9 = 72
8 / 9 = 0
************
9 + 11 = 20
9 - 11 = -2
9 * 11 = 99
9 / 11 = 0
************