Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- main(){
- double a[4];
- for(int i=0; i<3; i++)
- {
- a[i]=0;
- cout<<"Введите числа"<<endl;
- cin>>a[i];
- }
- char c[3];
- for (int i = 0; i < 2; i++)
- {
- c[i]='+';
- cout<<"Введите действия"<<endl;
- cin>>c[i];
- }
- cout<<a[0]<<c[0]<<a[1]<<c[1]<<a[2]<<"=\t";
- double p=0;
- if(c[0]=='+')
- p=a[0]+a[1];
- if(c[0]=='*')
- p=a[0]*a[1];
- if(c[0]=='-')
- p=a[0]-a[1];
- if(c[0]=='/')
- p=a[0]/a[1];
- if(c[1]=='+')
- p=p+a[2];
- if(c[1]=='*')
- p=p*a[2];
- if(c[1]=='-')
- p=p-a[2];
- if(c[1]=='/')
- p=p/a[2];
- cout<<p<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement