Actually question is about entering to matrices , add , subtract and multiply them
I didn't now how to do this point
*******************
ask the user to enter data for matrices, such as:
Row#? Data for first matrix: _ (separated by commas)
. (figure out data in each column automatically from the row data)
Row#? Data for second matrix: _ (separated by commas)
. (figure out data in each column automatically from the row data)
If the user enter incorrect amount of data in any row, generate error message and ask
user for correct amount of data.
***************************************
?
cout << "Please enter your choice from the menu above : " ;
cin >> operation ;
// Display Error message if user enter not availble
// number of operation and ask him to enter again
if (operation < 1 || operation > 3 )
{
cout << "Error! Please enter a number avalible in menu above" << endl;
cin >> operation ;
}
// Ask the user about the size of each matrix
cout <<"How many rows are in the first matrix ? " ;
cin >> row1 ;
cout <<"How many columns are in the first matrix ? " ;
cin >> column1 ;
cout <<"How many rows are in the second matrix ? " ;
cin >> row2 ;
cout <<"How many columns are in the second matrix ? " ;
cin >> column2 ;
cout << endl ;
// Check the conditions which must be satsified to perform the operation
switch (operation)
{
case 1 :
{
if (row1 != row2 || column1 != column2 )
{
cout << "Error ! Number of rows/columns in matrix 1 must be equal to " << endl <<
"Number of rows/columns in matrix 2 to preform ADDITION" << endl << endl ;
system ("pause");
return -1 ;
}
break;
}
case 2 :
{
if (row1 != row2 || column1 != column2 )
cout << "Error ! Number of rows/columns in matrix 1 must be equal to " << endl <<
"Number of rows/columns in matrix 2 to preform SUBTRACTION" << endl << endl ;
system ("pause");
return -1 ;
}
case 3 :
{
if ( column1 != row2 )
cout << "Error ! Number of Columns in first matrix must be equal " << endl <<
"to number of rows in second matrix to prefom Multiplication" << endl << endl;
system ("pause");
return -1 ;
break;
}
}
// Ask user to enter first marix
cout << "First Matrix :" << endl ;