Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {//problema 6
- unsigned short n1,n2,n3,opt;
- cout<<"1.Media notelor;"<<endl;
- cout<<"2.Nota minima;"<<endl;
- cout<<"3.Nota maxima;"<<endl;
- cout<<"Optiunea dvs. e <1/2/3>: ";cin>>opt;
- cout<<"n1=";cin>>n1;
- cout<<"n2=";cin>>n2;
- cout<<"n3=";cin>>n3;
- switch (opt)
- {
- case 1: cout<<"Media aproximata: "<<(n1+n2+n3)/3<<endl;
- cout<<"Media exacta: "<<(float)(n1+n2+n3)/3;
- break;
- case 2: unsigned short mini;
- mini=(n1<n2)?n1:n2;
- mini=(mini<n3)?mini:n3;
- cout<<"Nota minima:"<<mini;break;
- case 3: unsigned short maxi;
- maxi=(n1<n2)?n2:n1;
- maxi=(maxi<n3)?n3:maxi;
- cout<<"Nota maxima:"<<maxi;break;
- default : cout<<"OPTIUNE INEXISTENTA!";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement