Advertisement
Guest User

ranyboskie

a guest
Jun 28th, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4. #include <cstdlib>
  5. #include <cstdio>
  6. using namespace std;
  7.  
  8. int main(int argc, char *argv[])
  9. {
  10.  
  11.     int x = 0;
  12.     while(x>5 || x<1)  //
  13.      do{
  14.     {
  15.     cout<<"\n\n*******************MENU********************"<<endl;
  16.     cout<<"1.Wprowadz wektor"<<endl;
  17.     cout<<"2.Dodaj wektory"<<endl;
  18.     cout<<"3.Odejmij wektory"<<endl;
  19.     cout<<"4.Iloczyny wektorowe"<<endl;
  20.     cout<<"5.Wyjscie z programu."<<endl;
  21.     cout<<"Wybieram : ";
  22.     cin>>x;
  23.     system("cls");
  24.      }
  25.     double ax,ay,az,bx,by,bz,cx,cy,cz;
  26.    
  27.     switch (x)
  28.    
  29.    
  30.     {
  31.        case 1:
  32.         cout<< "Podaj wspolrzedne wektorow: ";
  33.         cout<< "Podaj A= "; cin>>ax>>ay>>az;
  34.         cout<< "Podaj B= "; cin>>bx>>by>>bz;
  35.               break;
  36.        case 2:
  37.        cout<< "A+B= "<<ax+bx<< "|" <<ay+by << "|"<<az+bz;
  38.       std::cin.ignore();
  39.      
  40.               break;
  41.        case 3:
  42.         cout<< "A-B= "<<ax-bx<< "|" <<ay-by<< "|" <<az-bz;
  43.               break;
  44.        case 4:  
  45.        cout<< "AoB= "<<ax*bx+ay*by+az*bz;
  46.         cx=ay*bz-az*by;
  47.         cy=ax*bz-az*bx;
  48.         cz=ax*by-ay*bx;
  49.        
  50.         cout<< "\n\nAxB= "<<cx<<cy<<cz;              
  51.               break;
  52.        case 5:    
  53.               break;    
  54.            }
  55.  
  56. }while(x!=5);
  57.     system("PAUSE");
  58.     return(0);
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement