Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Arith{
- public:
- int a1, a2, count;
- int make(int a1){
- cin >> a2;
- switch(sym){
- case '+': a1 += a2; break;
- case '-': a1 -= a2; break;
- case '*': a1 *= a2; break;
- case '%': a1 %= a2; break;
- }
- count++;
- return a1;
- }
- };
- int main()
- {
- int a1;
- char sym;
- Arith arith;
- cin >> a1 >> sym;
- while(sym != 'C'){
- arith.make(a1, sym);
- if(arith.count % 3 == 0)
- cout << arith.a1 << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement