Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- unsigned long x,a,b,e;
- do {
- cout<<"1.adunare"<<endl;
- cout<<"2.scadere(in modul)"<<endl;
- cout<<"3.inmultire"<<endl;
- cout<<"4.impartire(doar catul)"<<endl;
- cout<<"5.exit"<<endl;
- cout<<"optiunea dvs e:"<<'\t';
- cin>>x;
- if (x!=5){
- cout<<"a=";cin>>a;
- cout<<"b=";cin>>b;
- }
- switch (x)
- {
- case 1:e=a+b;break;
- case 2:e=abs((double)a-(double)b);break;
- case 3:e=a*b;break;
- case 4:e=(a>b)?a/b:b/a;break;
- default : if (x!=5)
- cout<<"optiune invalida"<<endl;
- }
- if (x!=5)
- cout<<"E="<<e<<endl;
- else
- cout<<"mersi pt utilizare"<<endl;
- } while (x!=5);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement