Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {//problema 7
- cout<<"1.Triunghi"<<endl;
- cout<<"2.Dreptunghi"<<endl;
- cout<<"3.Cerc"<<endl;
- cout<<"4.Terminare"<<endl;
- unsigned short opt;
- float A,P;
- cout<<"Optiunea d-voastra:";
- cin>>opt;
- switch (opt)
- {
- case 1: float a,b,c,p;
- cout<<"a=";cin>>a;
- cout<<"b=";cin>>b;
- cout<<"c=";cin>>c;
- P=a+b+c;
- p=P/2;
- A=sqrt(p*(p-a)*(p-b)*(p-c)); break;
- case 2: float l,L;
- cout<<"l=";cin>>l;
- cout<<"L=";cin>>L;
- P=2*(l+L);
- A=l*L; break;
- case 3: float r;
- P=2*r*M_PI;
- A=r*r*M_PI; break;
- case 4: return 0;
- default : cout<<"OPTIUNE INEXISTENTA!!!";
- }
- cout<<"P="<<P<<endl;
- cout<<"A="<<A<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement