Assume has been included and the following variable has been declared: char ch; Create code that would be a part of main() that will do the following: Prompt the user to enter one of the following characters: c, n, a, or f Use a nested if-else statement to display one of the following strings: “CBS is on Channel 2 in Los Angeles” if the character is ‘c’ or ‘C’ “NBC is on Channel 4 in Los Angeles” if the character is ‘n’ or ‘N’ “ABC is on Channel 7 in Los Angeles” if the character is ‘a’ or ‘A’ “FOX is on Channel 11 in Los Angeles” if the character is ‘f’ or ‘F’ “Invalid character entered” if any other character is entered Here are the rules: Submit only the code you are asked to write. You do not need to submit a main program. Please include the function header. Your code must follow all C++ syntax rules and compile. You must use a nested if-else statement.
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Assume <iostream> has been included and the following variable has been declared:
char ch;
Create code that would be a part of main() that will do the following:
- Prompt the user to enter one of the following characters: c, n, a, or f
- Use a nested if-else statement to display one of the following strings:
- “CBS is on Channel 2 in Los Angeles” if the character is ‘c’ or ‘C’
- “NBC is on Channel 4 in Los Angeles” if the character is ‘n’ or ‘N’
- “ABC is on Channel 7 in Los Angeles” if the character is ‘a’ or ‘A’
- “FOX is on Channel 11 in Los Angeles” if the character is ‘f’ or ‘F’
- “Invalid character entered” if any other character is entered
Here are the rules:
- Submit only the code you are asked to write. You do not need to submit a main program. Please include the function header.
- Your code must follow all C++ syntax rules and compile.
- You must use a nested if-else statement.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images