Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Arith{
  5. public:
  6.     int a1, a2, count;
  7.     int make(int a1){
  8.         cin >> a2;
  9.         switch(sym){
  10.             case '+': a1 += a2; break;
  11.             case '-': a1 -= a2; break;
  12.             case '*': a1 *= a2; break;
  13.             case '%': a1 %= a2; break;
  14.         }
  15.         count++;
  16.         return a1;
  17.     }
  18. };
  19.  
  20. int main()
  21. {
  22.     int a1;
  23.     char sym;
  24.     Arith arith;
  25.     cin >> a1 >> sym;
  26.     while(sym != 'C'){
  27.         arith.make(a1, sym);
  28.         if(arith.count % 3 == 0)
  29.             cout << arith.a1 << endl;
  30.     }
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement