Answer:
// code in C++.
#include <bits/stdc++.h>
using namespace std;
// function to print attitude
void printAttitude(int n)
{
// if input is 1
if(n==1)
cout<<"disagree"<<endl;
// if input is 2
else if(n==2)
cout<<"no opinion"<<endl;
// if input is 3
else if(n==3)
cout<<"agree"<<endl;
}
// main function
int main()
{ // variable
int n;
cout<<"Enter a number:";
// read the input number
cin>>n;
// call the function
printAttitude(n);
return 0;
}
Step-by-step explanation:
Read a number from user and assign it to "n".Then call the function printAttitude() with parameter "n".In this function, if the input number is 1 then it will print "disagree", if the input number is 2 then it will print "no opinion" and if the input number is 3 then it will print "agree".function will do nothing if the input number is anything else.
Output:
Enter a number:2
no opinion