Answer :
Answer:
Following are the program in the C++ Programming Language.
//define function
void printAttitude(int input)
{
//set the switch statement
switch(input)
{
//check the condition that argument is 1
case 1:
//print message then, break the statement
cout<<"disagree";
break;
//check the condition that the argument contain 2
case 2:
//print message then, break the statement
cout<<"no opinion";
break;
//check the condition that the argument contain 3
case 3:
//print message then, break the statement
cout<<"agree";
break;
}
}
Explanation:
Following are the description of the program:
- Firstly, set void type function that is 'printAttitude()' with integer data type argument that is 'input'.
- Then, set the switch statement that checks the value of the variable 'input', if the value of the variable 'input' is 1 then, print the message 'disagree' then, if the value is 2 it prints 'no opinion' and if the value is 3 then, it prints 'agree'.