+1(316)4441378

+44-141-628-6690

Archive for the ‘C++ Programming’ Category

Menu based program

Write a menu based program implementing the following functions:

(0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following:

a do/while loop with the displayMenu function call inside the loop body
switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu.
the do/while loop should always continue as long as the user does not choose to quit the program.
(1) Write a function that prompts the user for the name of a file to output as a text file that will hold a two dimensional array of the long double data type.

Have the program prompt the user to enter the number of rows and the number of columns for the two dimensional array.

Have the program prompt the user to enter the values for each row and column element in the two dimensional array.

Wr

Array Shifter and Array Reversal

Array Shifter and Array Reversal

Write a function that accepts an array of doubles and the arrays size as arguments. The
function should create a new array that is one element larger than the argument array.

The first element of the new array should be set to 0. Element 0 of the argument array should be copied to element 1 of the new array, element 1 of the argument array should be copied to element 2 of the new array, and so forth. The function should return a pointer to the new array.

Write a second function that accepts an array of doubles and the arrays size as arguments. The function should create a new array that contains all of the original array's elements in reverse order.

Last of all, have a main function that demonstrates the correct working of these two functions.

To be submitted:

Flowchart of your program design using draw.io.
C++ source code file (.cpp file) of your program.

Array Shifter and Array Reversal

Array Shifter and Array Reversal

Write a function that accepts an array of doubles and the arrays size as arguments. The
function should create a new array that is one element larger than the argument array.

The first element of the new array should be set to 0. Element 0 of the argument array should be copied to element 1 of the new array, element 1 of the argument array should be copied to element 2 of the new array, and so forth. The function should return a pointer to the new array.

Write a second function that accepts an array of doubles and the arrays size as arguments. The function should create a new array that contains all of the original array's elements in reverse order.

Last of all, have a main function that demonstrates the correct working of these two functions.

To be submitted:

Flowchart of your program design using draw.io.
C++ source code file (.cpp file) of your program.

Rainfall Stats

Write a program that lets the user enter the total rainfall for each of 12 months into an array of doubles. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Also, prompt your user for a file name and have the program save the calculated statistics to the file.

Directions in attachment