Here is the question:
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.
my code:
im getting a compile error, but i dont know which because this is an online lab kinda thing.Code:void printAttitude(int) { if int==1 printf("disagree\n"); if int==2 printf("no opinion\n"); if int==3 printf("agree\n"); }
anyone know what i'm doing wrong or have tips? i tried a few other things but to no avail.