Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include "cmath"
  4.  
  5. using namespace std;
  6.  
  7. unsigned const int N = 0;
  8.  
  9. double Vypocet(double vc1[N], double vc2[N])
  10. {
  11. for (int i=0; i < N; i++)
  12. {
  13. double x = 0, x1 = 0, y = 0, y1 = 0, sc = 0, sc1 = 0;
  14. x += pow(vc1[i], 2);
  15. x1 = sqrt(x);
  16. y += pow(vc2[i], 2);
  17. y1 = sqrt(x);
  18. sc += (vc1[i]*vc2[i]);
  19. sc1 = sc / (x1*y1);
  20. return sc1;
  21. }
  22. }
  23.  
  24. int main()
  25. {
  26.  
  27. double *vctra = new double[N];
  28. double *vctrb = new double[N];
  29.  
  30. for(int i = 0; i <= N; i++)
  31. {
  32. if(!cin.fail())
  33. {
  34. cin >> N;
  35. cin >> vctra[i];
  36. cin >> vctrb[i];
  37. }
  38. else
  39. {
  40. cout << "Nespravny vstup." << endl;
  41. delete [] vctra;
  42. delete [] vctrb;
  43. return -1;
  44. }
  45. }
  46.  
  47.  
  48.  
  49. cout << "CSM: " << Vypocet(vctra, vctrb);
  50.  
  51.  
  52.  
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement