×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# loopy getting closer

## loopy getting closer

(OP)
I have discovered that part of my problem was to do with strcmpy so I have scrapped that for now but i still have probs getting the correct message (not as many probs though)

//take 20 throws output message for each throw

#include <stdio.h>
#include <math.h>
#include <string.h>

void main()
{
int

sum=0,
average=0,
throws=20,
score[20],
i, j, k,
total=0;

double standarddev; ???

//char    message[11][10];

for( i= 0; i<throws; i++ )
{
printf("Enter score > ");
scanf("%d",&score );
total+=score;
}
average = total/throws;

for(j=0;j<throws;j++ )
sum+= (score[j] - average) * (score[j] - average);
// would this be better:-  sum+=pow(score[j] - average,2)

standarddev = sqrt(sum / (throws -1));

for(j=0; j < throws; j++)
{
if(score[j] >= average + 1.5 * standarddev)
printf("\n%d \t %d \texcellent",j+1,score[j]);

if(score[j] >= average + 0.5 * standarddev)
printf("\n %d \t %d \tGood",j+1,score[j]);

if(score[j] >= average - 0.5 * standarddev)
printf("\n%d \t%d \tFair",j+1,score[j]);

if(score[j] >= average - 1.5 * standarddev)
printf("\n%d \t %d \tPoor",j+1,score[j]);

if(score[j] <  average - 1.5 * standarddev)
printf("\n%d \t %d \tVery Poor",j+1,score[j]);
}

}
///////// check variables //////////
//printf("\n\n");

//for(k=0; k< throws; k ++)
//    {
//     printf("\n%d\t%d\t%s",k+1,score[k], message[k]);
//   }
// printf("\nsum = %d",sum);
// printf("\tstdv = %d",(int)standarddev);
//printf("\taverage = %d",average);
}

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!