1. ## Some quick help please with functions.

Hey this is some of my homework and i only have 3 questions. Here are the questions and what i have tried for my answer. I also put the error that i recieve.

1. Given the char * variables name1, name2, and name3, write a fragment of code that assigns the largest value to the variable max (assume all three have already been declared and have been assigned values).

i put:
Code:
```if(strcmp(name1,name2,name3)=name1)
max = name1;
else if(strcmp(name1,name2,name3)=name2)
max = name2;
else ( max = name3;)```
errors: You might want to recall what strcmp returns when
one string is greater than another.
You have to use a relational operator in this exercise.

2. Write an expression that evaluates to true if the value of the string variable s1 is greater than the value of string variable s2.

i put:
Code:
`strcmp(*s1,*s2) = s1`
errors:You might want to recall what strcmp returns when
one string is greater than another.
You have to use a relational operator in this exercise.
There is no need to use an assignment operator here.

3.Write the definition of a function minMax that has five parameters. The first three parameters are integers. The last two are set by the function to the largest and smallest of the values of the first three parameters. The function does not return a value.

The function can be used as follows:

Code:
```int a=31, b=5, c=19 big, small;
minMax(a,b,c,&big,&small);
/* big is now 31 */
/* small is now 5 */```
my code:
Code:
```  void minMax(int a,int b, int c, int &big, int &small){(if(a>b && a>c){
a=big};
if(b>a && b>c){
b=big};
else if(c>a && c>b){
c=big};
else if(a<b && a<c){
a=small};
else if(b<a && b<c){
b=small};
else (c=small);

}```
errors:Mismatched ( and }
Common Errors:
- Make sure your if/else statements are correct.
- Make sure you have semicolons at the end of each statement.
- Make sure you are assigning the correct values to big and small.

thanks so much guys

2. your third question seemes pretty simple to solve your syntax for that function is either really weird and barely used or wrong here is how I would write it
Code:
```void minMax(int a,int b, int c, int &big, int &small){
if(a>b && a>c){
a=big;
}
if(b>a && b>c){
b=big;
}
else if(c>a && c>b){
c=big;
}
else if(a<b && a<c){
a=small;
}
else if(b<a && b<c){
b=small;
}
else{
c=small;
}
}```

3. This is what the "relational operator" comments are referring to:

When you say
a = b
you are assigning the value of b to a. In other words, changing the value of a.

If you want to compare two variables, but not change the value of either, you say
if (a == b)

The "mismatched" comments are telling you that the number of left parentheses in your code is not equalto the number of right parentheses. They must be equal. Same with left and right brackets.

Code:
`In other words, every ( must be matched with a ), every { must be matched with a }`
You are using strcmp incorrectly. You should read a manual or textbook explanation of how it works.

4. ## nothing has helped me

The code that you posted still says it is incorrect.
how do i use strcmp?

5. NAME
strcmp, strncmp - compare two strings

SYNOPSIS
#include <string.h>

int strcmp(const char *s1, const char *s2);

int strncmp(const char *s1, const char *s2, size_t n);

DESCRIPTION
The strcmp() function compares the two strings s1 and s2. It returns
an integer less than, equal to, or greater than zero if s1 is found,
respectively, to be less than, to match, or be greater than s2.

The strncmp() function is similar, except it only compares the first
(at most) n characters of s1 and s2.

RETURN VALUE
The strcmp() and strncmp() functions return an integer less than, equal
to, or greater than zero if s1 (or the first n bytes thereof) is found,
respectively, to be less than, to match, or be greater than s2.

6. For example:

Code:
```result = strcmp(string1,string2)
if (result < 0)
printf("string1 is less\n");
else if (result > 0)
printf("string2 is less\n);
else
printf("both strings are equal\n");```