subject

The purpose of this assignment is to practice writing code that calls functions, and contains loops and branches. You will create a C program that prints a menu and takes user choices as input. The user will make choices regarding different plus (+) or X figures that will be printed to the screen.

Instructions:
The code must contain at least one of all of the following control types:

nested for() loops
a while() or a do-while() loop
a switch() statement
an if-else statement
five functions (in addition to the main() function)
Consider which control structures will work best for various aspects of the assignment. (Hint: What control type can be used with a menu driven program? How many statements should a case for a switch statement contain? Where would nested loops be appropriate for this program?)

The first thing your program will do is print a menu of choices for the user. You may choose your own version of the wording or order of choices presented, but each choice given in the menu must match the following:

Menu Choice Valid User Input Choices
Enter/Change Character 'C' or 'c'
Enter/Change Number 'N' or 'n'
Print Plus (+) Figure '1'
Print X Figure '2'
Quit Program 'Q' or 'q'

A prompt is presented to the user to enter a choice from the menu. If the user enters a choice that is not a valid input, a message stating the choice is invalid is displayed and the menu is displayed again.

Your program must have at least five functions (not including main()) including:

A function that prints the menu of choices for the user, prompts the user to enter a choice and retrieves that choice. The return value of this function must be void. It will have one pass-by-reference parameter of type char. On the function's return, this parameter will contain the user's entry, which is then used to determine the next action performed by the program. This function should allow the user to enter any value. In other words, it will not check for proper input. It will store the user input in the pass-by-reference variable and return, even if the input is not a valid menu choice.
A function that prompts the user to enter a single character. The return value of the function must be of type char and will return the character value entered by the user. This return value will be stored in a local variable, C (or whatever variable name you choose), in main(). The initial default value of this character will be ' ' (blank or space character).
A function that prompts the user to enter a odd number between 3 and 15 (inclusive). If the user enters an even number or a value outside this range, the user is prompted to re-enter a value until a proper value is entered. The return value of the function must be of type int and will return the value entered by the user. This return value will be stored in a local variable, N (or whatever variable name you choose), in main(). The initial default value of this integer will be 0.
Two "Print Figure" functions. Each function will take the current integer value N and character value C as input parameters. The return values of these functions will be void. The functions will print figures of N lines and columns using the input character C. The Plus function will print the figure as a plus (+) sign. The X function will print the figure as a X. For example, if the integer value N = 5, and the character value C = '*' and the X function is called, the following figure will be printed:

* *

*

* *

If the Plus function is to called, then the following figure is printed:
*
*

*
*

Note that if the user attempts to print the figure before entering any values for C or N (or whatever variable name you choose), your program will still call the functions to print the figure. However, if N = 0 (the default value), the function will print a figure with no lines or columns (i. e nothing). If C = ' ' (the default), the function will print a figure with N lines or columns, but since C is the blank character, no figure will be seen.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
You have a large, late-model pick-up truck with a rear seat. the pick-up truck weighs 6,500 pounds. the florida seat belt law
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
This program should be a short piece of code that prints all of the positive integers from 1 to 100 as described more fully below. the program may contain multiple methods, and if using an oo language, should be contained within a single class or object. the program should be designed so that it begins execution when invoked through whichever mechanism is most common for the implementation language. â–ş print out all positive integers from 1 to 100, inclusive and in order. â–ş print messages to standard output, matching the sample output below. â–ş in the output, state whether the each integer is 'odd' or 'even' in the output. â–ş if the number is divisible by three, instead of stating that the number is odd or even, state that the number is 'divisible by three'. â–ş if the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is 'divisible by two and three'. â–ş design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic. sample output the number '1' is odd. the number '2' is even. the number '3' is divisible by three. the number '6' is divisible by two and three.
Answers: 1
question
Computers and Technology, 24.06.2019 03:00
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
Think of a spreadsheet as a giant calculator spread of paper chart data collector
Answers: 2
You know the right answer?
The purpose of this assignment is to practice writing code that calls functions, and contains loops...
Questions
question
Medicine, 23.03.2021 17:00
question
Mathematics, 23.03.2021 17:00
question
Mathematics, 23.03.2021 17:00
Questions on the website: 13722360