Hows this?

Hello guys
I suck at martix operations and decided to make this,
im pretty proud of myself since I used my previous kmowledge
Here it is:


#include <iostream>

using namespace std;

int main()
{
int a;
int a1;
int b;
int b1;
int c;
int c1;
int d;
int d1;
int e;
int e1;
int f;
int f1;



cout << "Enter the 1st number of the 1st line";
cin >> a;
cout << "Enter the 2nd number of the 1st line";
cin >> b;
cout << "Enter the 3rd number of the 1st line";
cin >> c;
cout << "Enter the 1st number of the 2nd line";
cin >> d;
cout << "Enter the 2nd number of the 2nd line";
cin >> e;
cout << "Enter the 3rd number of the 2nd line";
cin >> f;

cout << "Now for the 2nd Grid"<< "Enter the 1st number of the 1st line";
cin >> a1;
cout << "Enter the 2nd number of the 1st line";
cin >> b1;
cout << "Enter the 3rd number of the 1st line";
cin >> c1;
cout << "Enter the 1st number of the 2nd line";
cin >> d1;
cout << "Enter the 2nd number of the 2nd line";
cin >> e1;
cout << "Enter the 3rd number of the 2nd line";
cin >> f1;

cout<< a+a1 << " "<< b+b1 <<" " << c+c1 <<" "<< endl << d+d1 << " " << e+e1 <<" "<< f+f1;

return 0;
}


Let me know if I did anything good or bad and also is there a way I could direct them to an alternative cout to say they want to multiply instead of add. Let me know, thanks in advance
Wouldn't this be easier in a 2D array instead? Then you could simply pass the array around...the array concept could possibly be over your head though.
Topic archived. No new replies allowed.