daily pastebin goal
21%
SHARE
TWEET

EX6

STANAANDREY Jan 18th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {//problema 6
  6.  unsigned short n1,n2,n3,opt;
  7.    cout<<"1.Media notelor;"<<endl;
  8.    cout<<"2.Nota minima;"<<endl;
  9.    cout<<"3.Nota maxima;"<<endl;
  10.    cout<<"Optiunea dvs. e <1/2/3>: ";cin>>opt;
  11.    cout<<"n1=";cin>>n1;
  12.    cout<<"n2=";cin>>n2;
  13.    cout<<"n3=";cin>>n3;
  14.    switch (opt)
  15.    {
  16.        case 1: cout<<"Media aproximata: "<<(n1+n2+n3)/3<<endl;
  17.                cout<<"Media exacta: "<<(float)(n1+n2+n3)/3;
  18.                break;
  19.        case 2: unsigned short mini;
  20.          mini=(n1<n2)?n1:n2;
  21.          mini=(mini<n3)?mini:n3;
  22.            cout<<"Nota minima:"<<mini;break;
  23.        case 3: unsigned short maxi;
  24.          maxi=(n1<n2)?n2:n1;
  25.          maxi=(maxi<n3)?n3:maxi;
  26.          cout<<"Nota maxima:"<<maxi;break;
  27.          default : cout<<"OPTIUNE INEXISTENTA!";
  28.    }
  29. return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top