Advertisement
andreisophie

Concurs forme

Jan 16th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #define pi 3.14159265359
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int n;
  10.     string aux;
  11.     float l,l1,l2,r;
  12.     vector <string> forma;
  13.     vector <float> suprafata;
  14.     cin>>n;
  15.     for(int i=0;i<n;i++)
  16.     {
  17.         cin>>aux;
  18.         forma.push_back(aux);
  19.         if(aux =="patrat")
  20.         {
  21.             cin>>l;
  22.             suprafata.push_back(l*l);
  23.         }
  24.         else
  25.             if(aux=="dreptunghi")
  26.             {
  27.                 cin>>l1,l2;
  28.                 suprafata.push_back(l1*l2);
  29.             }
  30.             else
  31.                 if(aux=="cerc")
  32.                 {
  33.                     cin>>r;
  34.                     suprafata.push_back(pi*r*r);
  35.                 }
  36.     }
  37.     for(int i=0;i<forma.size();i++)
  38.     {
  39.         cout<<forma.at(i)<<" "<<suprafata.at(i)<<endl;
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement