Can anybody help me with some or all of these problems?

Problem 1:

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:
intª a=31, b=5, c=19 big, small; minMax(a,b,c,&big,&small); /* big is now 31 */ /* small is now 5 */

I think the answer is

void minMax(int a, int b, int c, int* big, int* small){
if(a<c && a<b)*small=a;
else if(b<c && b<a)*small=b;
else if(c<a && c<b)*small=c;
else if(a>b && a>c)*big=a;
else if(b>a && b>c)*big=b;
else if(c>a && c>b)*big=c;
}

Problem 2:

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 think the answer is

if(strcmp name1>strcmp name2 &&strcmp name1>strcmp name3)max=name1;
else if(strcmp name2>strcmp name1 && strcmp name2>strcmp name3)max=name2;
else if(strcmp name3>strcmp name1 && strcmp name3>strcmp name2)max=name3;

Problem 3:

Write a sequence of statementsª that finds the first comma in the stringª line, and assignsª to the variableª clause the portion of line up to, but not including the comma. You may assumeª that an intª variableª pos, as well as the variablesª line and clause, have alreadyª been declaredª.

I think the answer is

pos.line(",");
clause=line.substr(0,pos-1);

Problem 4:

Write a function called printStars. The function receives an intªparameterª. If the parameterª is positive, the function prints (to standard outputª) the givenª number of asterisks; otherwise the function does nothing. The function does not return a valueª. Thus, if the printStars(8) is called, ******** (8 asterisks) will be printed.
The function must not use a loop of any kind (for, while, do-while) to accomplish its job. Instead, it gets the job done by examining its parameterª, returning if the parameterª's valueª is not positive. If the parameterª is positive, it
prints a single asterisk (and no other charactersª)
then (recursively) calls itself to print the remaining asterisks.

I think the answer is

int i = 0;
void printStars(int starCount){
if(starCount>0){
if(i<starCount){
cout<<"*";
starCount;
i++;
printStars(starCount);
}
}
}

Thank you SO much,
C++

ahhh cmon no one's gonna help the man????......he even tried all of the problems out and posted his gues for the answers....he posted it 3 days ago and 0 rplays so far. I'd answer but i don't know much about programming so yea

He opened another thread with the same question and that has had a lively set if interactions in it. That's probably why there's not much here.

o ok im sorry i did'nt see that he did that.........i just wanted to point out that no one was helping him out but obviously i was wrong, because it was all answered in the other thread. Sorry for the mix up

This article has been dead for over six months. Start a new discussion instead.