Write 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.
.
.
Click on the title for the solution
.
.
void printAttitude (int x)
{
if (x==1) cout<<"disagree"<<endl;
else if (x==2) cout<<"no opinion"<<endl;
else if (x==3) cout<<"agree"<<endl;
}
.
Click on the title for the solution
.
.
This is the answer:
:
void printAttitude (int x)
{
if (x==1) cout<<"disagree"<<endl;
else if (x==2) cout<<"no opinion"<<endl;
else if (x==3) cout<<"agree"<<endl;
}
Comments
Post a Comment