Suppose we have the following class class Matrix private Page-00996
This subjective question is related to the book/course vu cs605 Software EngineeringII. It can also be found in vu cs605 Mid Term Solved Past Paper No. 2.
Question 1: Suppose we have the following class.
class Matrix {
private:
Page. No. 12/15
int Elements[3][3];
};
Write the operator function of stream extraction operator (>>) for this class.
cout<<element[0][0]<<element[0][1]<<element[0][2];
cout<<element[1][0]<<element[1][1]<<element[1][2];
cout<<element[2][0]<<element[2][1]<<element[2][2];
}
class Matrix {
private:
Page. No. 12/15
int Elements[3][3];
};
Write the operator function of stream extraction operator (>>) for this class.
Answer:
Element operator >> (Element &element){cout<<element[0][0]<<element[0][1]<<element[0][2];
cout<<element[1][0]<<element[1][1]<<element[1][2];
cout<<element[2][0]<<element[2][1]<<element[2][2];
}