Advertisement
Gireada

Tema nr.6 Info Part2

Nov 5th, 2012
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream.h>
  2. #include <conio.h>
  3.  
  4.  
  5. int main()
  6. {int a, L[2], r[2], t[3];
  7. cout<<"Ce doriti sa calculati:\n";
  8. cout<<"1. Aria unui patrat;\n";
  9. cout<<"2. Aria unui cerc;\n";
  10. cout<<"3. Aria unui triunghi;\n";
  11. cout<<"Scrieti ce operatie doriti:";cin>>a;
  12.  
  13.     switch(a)
  14.     {
  15.         case 1:
  16.         {
  17.             cout<<"Scrieti lungimea laturii:";cin>>L[0];
  18.             L[0] = L[0]*L[0];
  19.             cout<<"Aria este:";cout<<L[1];
  20.         }break;
  21.         case 2:
  22.         {
  23.             cout<<"Scrieti valoarea lui r:";cin>>r[0];
  24.             r[1] = 3.14*(r[0]*r[0]);
  25.             cout<<"Aria este:";cout<<r[1];
  26.         }break;
  27.         case 3:
  28.         {
  29.             cout<<"Scrieti inaltimea si baza:";cin>>t[0];cint>>t[1];
  30.             t[2] = (t[0]*t[1])/2;
  31.             cout<<"Aria este:";cout<<t[2];
  32.         }break;
  33.         default: cout<<"Nu am gasit aceasta operatie";
  34.     }
  35.     getch();
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement