Question: Write a C++ program that shows the following menu: P[attern] S[inusoidal Signal] C[onversion] Q[quit] x If you select P or p, you should invoke a
Write a C++ program that shows the following menu:
P[attern] S[inusoidal Signal] C[onversion] Q[quit] x If you select "P or p", you should invoke a user-defined function, void pattern (void) to prompt the user to enter number of lines that he/she wishes to display, as well as the type of character to display. You must use only nested loops to the maximum extend possible and do not use any type of global variables to generate the output shown below. Your program should have the following format: P[attern] S[inusoidal Signal] C[onversion] Q[quit] Enter your choice: P You have selected the pattern option.
Enter number of lines in the pattern: 6 * Enter type of character to display: * *** ***** ******* ********* ***********
x If you select "c or C" you should invoke a user define function void convert (double, double, char) to convert all the temperatures between TempMIN and TempMAX entered by the user, from Celsius to Fahrenheit, or vice versa. The user needs to input C or c to convert to Celsius and F or f to convert to Fahrenheit. The following formulas are employed.
F = (9/5)C + 32 C = 5/9(F 32) P[attern] S[inusoidal Signal] C[onversion] Q[quit] Enter your choice: c You have selected Conversion option. Enter range of temperatures to convert: 25 35 Enter C or c to convert to Celsius and F or f to convert to Fahrenheit: C
Fahrenheit Celsius 25 -3.9 26 -3.3 27 -2.8 28 -2.2 29 -1.7 30 -1.1 31 -0.6 32 0.0 33 +0.6 34 +1.1 35 +1.7
x If you select "S or s" You should invoke a user-defined function, double Sine-Wave (void) that shows the values of a sinusoidal voltage generator at certain times and in different output formats. The voltage can be described by the following equation. Assigned: October 1, 2018
Due Date: October 11, 2018
Voltage = sin (2 * S * f * t) where sin = sinusoidal function from trigonometry f = frequency in Hertz = 1 Hz t = time in seconds S = the constant PI from mathematics The task of Sine-Wave function is to compute and display the Voltage values at time t = 0 seconds through t=1 second at 0.1 second intervals. This function will also prompt the user for output display format: Scientific or Decimal notation. You should use looping control structures in your program to compute the voltage values and Switch statements to determine the type of output. You will need to use the math library
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
