-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (23 loc) · 738 Bytes
/
Copy pathmain.cpp
File metadata and controls
35 lines (23 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <fstream>
#include "dotprod.cpp"
#include "scalarmult.cpp"
using namespace std;
int main() {
double vector1[3];
double vector2[3];
double scalar;
ifstream infile;
infile.open("vectors.txt");
infile >> vector1[0] >> vector1[1] >> vector1[2];
cout << "Vector 1 is (" << vector1[0] << ", " << vector1[1] << ", " << vector1[2] << ")" << endl;
infile >> vector2[0] >> vector2[1] >> vector2[2];
cout << "Vector 2 is (" << vector2[0] << ", " << vector2[1] << ", " << vector2[2] << ")" << endl;
infile >> scalar;
cout << "The scalar is " << scalar << endl;
infile.close();
dot_prod(vector1, vector2);
scalar_mult(vector1, scalar);
scalar_mult(vector2, scalar);
return 0;
}