Write a complete program for a Menu System that will display the following for its menu: MAIN MENU 1.) Display Triangle 2.) Multiplication Table 3.) Power Table 4.) Quit Enter your choice ( 1 – 4): The program must create the following User-Defined Functions prototyped as : 1.) void Triangle(void) - this UDF will be called by the main() function when 1 (Display Diamond) is selected from the Main Menu, to print the triangle-shaped arrangement of letters shown below. Printing should be done using nested loop inside the UDF body and should not be coded manually. 2.) void MultiplicationTable( int N) –this UDF will be called by the main() function when 2 ( Multiplication Table ) is selected from the Main Menu, to display the Multiplication Table for numbers from 1 to N, where N, the UDF’s argument, is a value to be entered from the keyboard. 3.) void PowerTable( int N )- this UDF will be called by the main() function when 3 ( Power Table ) is selected from the Main Menu, to display in tabulated form the 2nd, 3rd , 4th , and 5th power of numbers from 1 to N, where N, the UDF’s argument is a value to be entered from the keyboard. The UDF must print first the header: N N^2 N^3 N^4 N^5 The program must not use the built-in pow() function. You have to create your own pow() function prototyped as : void MyPow( double x, double y, double *z); This UDF will compute x raised to the y power without using the built-in cmath function and pass the computed value to main() function through its pointer parameter, *z. The Main Menu should be placed inside an infinite loop which will terminate only when 4 (Quit) is selected from the Main Menu. If an invalid choice is entered from the keyboard, the program will print,” Please enter 1 to 4 only for your choice.” Then, print again the Main Menu. 4) Write a complete program that will load a Two-Dimensional array A[7][7] with the first 49 numbers, then print the following : a.) the content of the original array b.) the content of the array with the elements of the 3rd row and 5th row interchanged. c.) the content of the array with the elements of the 2nd col and 6th col interchanged. d.) the content of the array with the 2 diagonal elements interchanged. Create two 2-Dimensional arrays. Copy the content of the 1st array to the 2nd Array, then manipulate its content for the output in (b.). Recopy again the content of the 1st array to the 2nd array, then, manipulate again the content of the 2nd array for the output in (c.) Do the same process for the output in (d.) Create a function named PrintArray for printing the content of the 1st array in (a) and the content of 2nd array after it had been manipulated to produce the required output in (b), (c.) and (d.)
Write a complete program for a Menu System that will display the following for its menu:
MAIN MENU
1.) Display Triangle
2.) Multiplication Table
3.) Power Table
4.) Quit Enter your choice ( 1 – 4):
The program must create the following User-Defined Functions prototyped as :
1.) void Triangle(void) - this UDF will be called by the main() function when 1 (Display Diamond) is selected from the Main Menu, to print the triangle-shaped arrangement of letters shown below. Printing should be done using nested loop inside the UDF body and should not be coded manually.
2.) void MultiplicationTable( int N) –this UDF will be called by the main() function when 2 ( Multiplication Table ) is selected from the Main Menu, to display the Multiplication Table for numbers from 1 to N, where N, the UDF’s argument, is a value to be entered from the keyboard.
3.) void PowerTable( int N )- this UDF will be called by the main() function when 3 ( Power Table ) is selected from the Main Menu, to display in tabulated form the 2nd, 3rd , 4th , and 5th power of numbers from 1 to N, where N, the UDF’s argument is a value to be entered from the keyboard. The UDF must print first the header: N N^2 N^3 N^4 N^5 The program must not use the built-in pow() function. You have to create your own pow() function prototyped as : void MyPow( double x, double y, double *z); This UDF will compute x raised to the y power without using the built-in cmath function and pass the computed value to main() function through its pointer parameter, *z. The Main Menu should be placed inside an infinite loop which will terminate only when 4 (Quit) is selected from the Main Menu. If an invalid choice is entered from the keyboard, the program will print,” Please enter 1 to 4 only for your choice.” Then, print again the Main Menu.
4) Write a complete program that will load a Two-Dimensional array A[7][7] with the first 49 numbers, then print the following :
- a.) the content of the original array
- b.) the content of the array with the elements of the 3rd row and 5th row interchanged.
- c.) the content of the array with the elements of the 2nd col and 6th col interchanged.
- d.) the content of the array with the 2 diagonal elements interchanged.
Create two 2-Dimensional arrays. Copy the content of the 1st array to the 2nd Array, then manipulate its content for the output in (b.). Recopy again the content of the 1st array to the 2nd array, then, manipulate again the content of the 2nd array for the output in (c.) Do the same process for the output in (d.) Create a function named PrintArray for printing the content of the 1st array in (a) and the content of 2nd array after it had been manipulated to produce the required output in (b), (c.) and (d.)
Step by step
Solved in 2 steps