PatrickSwayze

zad 5 wektor

Dec 18th, 2017
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. void mnozenie(int x, int y, int z)
  5. {
  6.     cout<<"Wektor po przemnozeniu to ["<<x*z<<","<<y*z<<"]"<<endl;
  7.  
  8. }
  9. void mnozenie(int a, int b, int z, int y)
  10. {
  11.     cout<<"Wektor po przemnozeniu to ["<<a*z<<","<<b*y<<"]"<<endl;
  12. }
  13. void mnozenie(int a, int b, int c, int d, int e, int f, int g, int h)
  14. {
  15.   cout<<" Macierz po wymnozeniu to: "<<endl;
  16.   cout<<(a*c)+(b*d)<<" "<<(a*b)+(d*h)<<endl;
  17.   cout<< (e*c)+(f*g)<<" "<<(e*d)+(f*h)<<endl;
  18. }
  19.  
  20.  
  21. int main(){
  22. int a,b,c,d,e,f,g,h,z,y,x;
  23. cout<<"Mnozenie wektora przez liczbe"<<endl;
  24. cout<<"Podaj dane wektora[a,b]"<<endl;
  25. cin>>a>>b;
  26. cout<<"Podaj liczbe do przemnozenia przez wektor"<<endl;
  27. cin>>z;
  28. mnozenie(a,b,z);
  29.  
  30. cout<<"Iloczyn skalarny dwu wektorow"<<endl;
  31. cout<<"Podaj [a,b] pierwszego wektora i [z,y] drugiego wektora"<<endl;
  32. cin>>a>>b>>z>>y;
  33. mnozenie(a,b,z,y);
  34.  
  35. cout<<"Mnozenie dwu macierzy przez siebie"<<endl;
  36. cout<<"Podaj wartosc pierwszej maciezy"<<endl;
  37. cout<<"a b"<<endl;
  38. cout<<"c d"<<endl;
  39. cin>>a>>b>>c>>d;
  40. cout<<"Teraz podaj druga macierz"<<endl;
  41. cout<<"e f"<<endl;
  42. cout<<"g h"<<endl;
  43. cin>>e>>f>>g>>h;
  44. mnozenie(a,b,c,d,e,f,g,h);
  45.  
  46.  
  47.  
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment