My assignment is to write a program that asks a user to enter two 1 x 3 vectors and then calculates the product. [a1 a2 a3] = first vector and [b1 b2 b3] = second vector. I have to create a user defined struct to hold each vector and the answer.
Can anyone guide me in the right direction. I'm a complete noob.. Here's what I have so far but it doesn't even work .
#include <iostream>
int main()
{
using namespace std;
struct x{
float a1;
float a2;
float a3;
};
struct y{
float b1;
float b2;
float b3;
};
struct ans{
float c1;
float c2;
float c3;
};
cout << "Please enter the first vector: " << endl;
cin >> x.a1; and cin >> x.a2 >> and cin >> x.a3;
cout << "Please enter the second vector: " << endl;
cin >> y.b1; and cin >> y.b2 >> and cin >> y.b3;