ndeniche 402 Posting Virtuoso Featured Poster

why not better work it out an even more simple way... get your string's length and create an array of characters as long as the string, which will substitute your string in the rest of the program. This way you can compare your guess individually with each element in the array...

i don't know... maybe it can make things a bit more simple...

ndeniche 402 Posting Virtuoso Featured Poster

oooohh... i know where your problem is... when you call

calcAverage

you are using your variable "small" instead of the function you used to find the smallest... your code should go this way in line 12:

calcAverage(score1,score2,score3,score4,score5,
findLowest(score1,score2,score3,score4,score5));

or, the other way around, you could do this before calling your calcAverage function:

small=findLowest(score1,score2,score3,score4,score5);

which will work exactly the same...

got it?

ndeniche 402 Posting Virtuoso Featured Poster

another thing... why are you using

int small

as a parameter in calcAverage?

ndeniche 402 Posting Virtuoso Featured Poster

this is because you have a small mistake right in the end...

erm... you aren't using four scores... you are actually using five scores...

ndeniche 402 Posting Virtuoso Featured Poster

why don't u better use a CHAR as a centinel? like this:

char ans;
   do{
      (program)
      printf("Do you wish to enter another temperature?");
      scanf("%c",&ans);
      }while ((ans=='y')||(ans=='Y'));
ndeniche 402 Posting Virtuoso Featured Poster

what you need to use is a for(), since it is better because you can instruct the cycle to do the procedure as many times as you want. Like this:

double x,multiplication=1; //create a second variable so you won't lose your x value
for (int i=0;i<n;i++){
   multiplication=multiplication*x; //multiply your x value to your stored multiplication in the variable you created
}

or if you were using a while(), you could do it this way:

double x,multiplication=1,i=0; //i is your centinel to stop the cycle
while (i<n){
   multiplication=multiplication*x;
   i++;
}
ndeniche 402 Posting Virtuoso Featured Poster

actually, what AD says bout the max/min value is absolutely the best way to do this. You just have to assign the value in the first variable to another one,so you can compare with if´s, so if it is lower than the temporary variable, you assign the value you just compared to this varuable and continue comparing.

As for the getScore function, you should initiate the 5-scores variables outside of the main, so they are general to the whole program, so you ask the user for them inside the getScore() function.

Now, the calcAverage() function should not be a problem.