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.

this is what i have so far:

void printAttitude(int){
if (int == 1){
cout << "disagree" << endl;
}
else-if (int == 2){
cout << "no opinion" << endl;
}
else-if (int == 3){
cout << "agree" << endl;
}
}

I don't think it's right, someone please help. thanks

*please delete double post*

what makes you think its wrong? The best way is to throw it into a compiler and find out!! - Only way to learn!

I can't see anything wrong here apart from your function header...

you've declared it to be an int but you have not created a varible

void printAttitude(int [B]a[/B])
{
  if (int [B]a[/B] == 1)
   {
   cout << "disagree" << endl;
   }
    else-if (int [B]a[/B] == 2)
   {
 cout << "no opinion" << endl;
   }
   else-if (int [B]a[/B] == 3)
   {
    cout << "agree" << endl;
    }
}

please use indentation and code tags!

>void printAttitude(int){
When you give a function a body, you must name each of the parameters:

void printAttitude ( int [B]name[/B] ) {

>if (int == 1){
int is a type, 1 is a value. You can't compare types with values. Once you name the function parameter, you can use that in your conditional tests because name has a value and can be compared with other values:

if ( [B]name[/B] == 1 ) {
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.