Question: program in C Write a program that displays attitude. You will have a method called printAttitude. Your main method will do the following: Ask the
program in C
Write a program that displays attitude. You will have a method called printAttitude. Your main method will do the following:
-
Ask the user for a value between 1 and 4. Use the following prompt: "Enter a value between 1 and 4". Use the puts() function for this.
-
Sort this value in an integer variable.
-
Call the printAttitude() function defined below.
Write the prototype and the definition of a function printAttitude, which has an int parameter and returns nothing. The function prints a message to standard output depending on the value of its parameter.
If the parameter equals 1, the function prints "disagree"
-
If the parameter equals 2, the function prints "no opinion"
-
If the parameter equals 3, the function prints "agree"
-
In the case of other values, the function does nothing.
Each message is printed on a line by itself (use puts or printf with a new line character) .
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
