Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Student {
- public:
- void oprt(int x, char z,int y) {
- if (z=='/') x=x/y;
- if (z=='*') x = x * y;
- if (z=='-') x=x-y;
- if (z=='+') x=x+y;
- }
- };
- int main()
- {
- Student abc;
- int x1, p,k=0;
- char ch1;
- cin >> p;
- while (k < 3) {
- cin >> ch1 >> x1;
- abc.oprt(p, ch1, x1);
- k++;
- }
- cout <<p;
- }
Add Comment
Please, Sign In to add comment