Could You Just Help Me Write The Right Code And Explain Me The Errors, Warnings? |
I have learned from these guys that such a request is NOT appreciated.
I cannot help with the actual code, but I (think) what will help them is to use a separate code tag for the class and the main function.
Next, use comments to explain what is happening. At least use comments to separate parts of your code like this: //-------------------------------
Shouldn't you do
1 2 3 4
|
cout<<"\n\n----MENU----";
cout<<"\n1.Multiplication Of Matrices";
cout<<"\n2.Transpose Of Matrix";
cout<<"\n Or press any key to exit.";
|
And then remove the case 3 and choose default case as:
?
Line 114 and 115 are kinda repetitive. You can ask them to put their numbers using spaces (Putting spaces makes the program treat them as separate integers), and to use Enter when they change the row.
And change input to
1 2 3 4 5 6 7 8 9 10
|
void setvalues(){
cout<<"Enter elements of your Matrix (Put space between numbers of the same row): \n";
for(int i=0;i<rows;i++)
{
for(int j=0;j<cols;j++)
{
cin>>matrix[i][j];
}
}
}
|
Although data representation is entirely up to you.
My own personal question to someone more experienced:
1. What is up with line 13 & 14? What if he does not initialize to zero?
Also similarly in line 64. But not in line 79
2. In line 17, is it a good programming practice to use dynamic memory allocation instead of a multidimensional array as a data member? What advantages does it offer?
a) Why did OP seemingly only allocate to a single-dimnsional array?
3. In line 8, what does a double asterisk mean?
4. How did he multiply? Can someone please expand line 69? I mean we are supposed to do
Answer(0,0) = First(0,0)*Second(0,0) + First(0,1)*Second(1,0) |
right?
But according to line 67-69, when i = 0, j = 1 ; Then we have
Answer(0,1) = First(0,1)*Second(1,0) |
5.