+ 3

I need help guys, a bit confusing on displaying the choices and code the function in the choices

Your program will manipulate a two dimensional array of size x * y (matrix). You should use user-defined functions which accept 2-D array, and its size x and y as arguments. Using an appropriate loop, display the following options as a menu: 1. Input elements into matrix of size x x y 2. To display elements of matrix of size x x y 3. Sum of all elements of matrix of size x x y 4. To display row-wise sum of matrix of size x x y 5. To display column-wise sum of matrix of size x x y 6. To create transpose of matrix B of size y x x 7. Quit program Enter your choice: _ Note that the array is a flexible size of rows and columns. Data entry validation codes are required to ensure the array structure can be created properly. Ensure the input and output are done in the exact 2-D structure of the stated array. The menu will always reappear at the completion of options 1 to 6. When option ‘7’ is chosen, clear the screen and then display a message to thank the user for using the program. If the user entered any other numbers (not 1 to 7), display the following message: ‘You have entered an invalid option. Please choose options 1 to 7 only’.

24th Jun 2019, 5:36 PM
Ashley Goth
Ashley Goth - avatar
6 Answers
+ 4
To add to Dejan's suggestion, assuming this is a console application, you'll want to make sure that's contained inside of a loop. You selecting the option to 'Exit' is what will break that outer loop that's containing the application. The loop is what will keep the program going while it's operating.
24th Jun 2019, 5:55 PM
AgentSmith
+ 3
Hi there, First you should create a menu with switch method and put those 7 options as cases, then relating to the case you should do the given task.
24th Jun 2019, 5:41 PM
Dejan FrancuzđŸ„‡
Dejan FrancuzđŸ„‡ - avatar
+ 3
Post up what you've already tried for your homework. Typically, I wouldn't help someone do their homework, but if you've made an attempt at it and are getting stuck on something, I'm more than happy to assist you resolve whatever issue you're having.
24th Jun 2019, 5:44 PM
AgentSmith
+ 1
@AgentSmith #include <iostream> #include <cstdlib> using namespace std; void menu(); int main(){ int x,y; cout << "Enter number of rows: "; cin >> x; cout << " enter number of columns:"; cin >> y; menu(); } void menu() cout << "1. Input the elements into matrix of size " << x << " x " << y << endl; cout << "2. To display elements of matrix size " << x << " x " << y << endl; cout << "3. Sum of all elements of matrix size " << x << " x " << y << endl; cout << "4. To display row-wise sum of matrix size " << x << " x " << y << endl; cout << "5. To display column-wise sum of matrix size " << x << " x " << y << endl; cout << "6. To create tranpose of matrix B of size " << x << " x " << y << endl; cout << "7. Quit program" <, endl; } this is what I did so far.
25th Jun 2019, 1:43 AM
Ashley Goth
Ashley Goth - avatar
+ 1
Ashley Goth nope, you should put everything into menu and instead of that function make switch method
25th Jun 2019, 9:38 AM
Dejan FrancuzđŸ„‡
Dejan FrancuzđŸ„‡ - avatar
0
Simply use switch() and make a menu
26th Jun 2019, 5:42 AM
Kulvardhan Singh Rathore
Kulvardhan Singh Rathore - avatar