Question: Problem 1 ---Functions: Write a program that converts from 24-hour notation to 12- hour notation.For example it should convert 14:25 to 2:25 PM. The input

Problem 1 ---Functions:

Write a program that converts from 24-hour notation to 12- hour notation.For example it should convert 14:25 to 2:25 PM. The input is given as two integers.

There should be at least three functions, one for input, one to do the conversion and one for output. Record the AM/PM information as a value of type char, A for AM and P for PM. Thus, the function for doing conversions will have a call-by-reference formal parameter of type char to record whether is AM or PM. (The function will have other parameters as well).

Include a loop in main() that lets the user repeat this computation for new input values again and again until the user says he or she wants to end the program.

Problem 2 -- Arrays

Implement following threefunctions for 1D array.

1)Write a function to input an array

void InputArray(intarr[], constintsize)

2)Write a function to Output an array

void OutputArray(intarr[], cons tint size)

3)Write a function to sort the array using selection sort. Do write swap function for swapping two values.

void SelectionSort(intarr[], constint size)

4)Write a function to reverse an array

void Reverse(intarr[], constint size)

Test your functions by calling them in main program.

Problem 3 --2D arrays

Implement following threedifferent functions for 2D array.

1)Write a function to input a 2D array.

void Input2DArray(intarr[][COLSIZE],constint Rows, constint Cols); //here COLSIZE is a constant

2)Write a function to Output a 2D array

void Output2DArray(intarr[][COLSIZE],constint Rows, constint Col); //here COLSIZE is a constant

3)Write a function to search a key in a 2D array if key is found the function should return true otherwise false.

boolFindKey(intarr[][COLSIZE], constint Rows, constint Cols, constint Key); //here COLSIZE is a constant

Test your function via menu. You will call the above functions in main.

c++ code using functions

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!