Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include "cmath"
- using namespace std;
- unsigned const int N = 0;
- double Vypocet(double vc1[N], double vc2[N])
- {
- for (int i=0; i < N; i++)
- {
- double x = 0, x1 = 0, y = 0, y1 = 0, sc = 0, sc1 = 0;
- x += pow(vc1[i], 2);
- x1 = sqrt(x);
- y += pow(vc2[i], 2);
- y1 = sqrt(x);
- sc += (vc1[i]*vc2[i]);
- sc1 = sc / (x1*y1);
- return sc1;
- }
- }
- int main()
- {
- double *vctra = new double[N];
- double *vctrb = new double[N];
- for(int i = 0; i <= N; i++)
- {
- if(!cin.fail())
- {
- cin >> N;
- cin >> vctra[i];
- cin >> vctrb[i];
- }
- else
- {
- cout << "Nespravny vstup." << endl;
- delete [] vctra;
- delete [] vctrb;
- return -1;
- }
- }
- cout << "CSM: " << Vypocet(vctra, vctrb);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement