×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • 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.

Students Click Here

Loopie loo

Loopie loo

Loopie loo

(OP)
Can anyone tell me whot on earth I have done wrong
the program compiles ok but I'm not getting the result I want, either there is something wrong with my loops , math or logic or even all 3
This is part of a program I am coding - everything elseis fine, ok here it is

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

void main()
{
 int'
 sum=0,
 average=0,
 throws=10,
 score[10],
 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);
     }
 standarddev = sqrt(sum / (throws -1));
              
 for(i=0; i<throws;i++ )
 {
  for(j=0; j < throws; j++)
     {                                   
      if(score[j] >= average + 1.5 * standarddev)
     strcpy(message[j],"excellent");            
                           
      if(score[j] >= average + 0.5 * standarddev)
    strcpy(message[j],"Good");

      if(score[j] >= average + 0.5 * standarddev)
          strcpy(message[j],"Fair");

      if(score[j] >= average + 1.5 * standarddev)
           strcpy(message[j],"Poor");

      if(score[j] <  average + 1.5 * standarddev)
           strcpy(message[j],"Very poor");                                                     
     }

  }
  printf("\n\n");
  message[j] == '\0';
 
  for(k=0; k< throws; k ++)
      {
       printf("\n%d\t%s",k+1, message[k]);
      }
 }


I'm working on the algo
i =0
while( i < throws)do
sum = sum + (score - average)squared
i=i+i
end while
standarddev = square rout of sum / (throws -1)



Here are the messages for each throw

Excellent if(score[j] >= average + 1.5 * standarddev)
                                    
Good if(score[j] >= average + 0.5 * standarddev)
    
Fair if(score[j] >= average + 0.5 * standarddev)
          
Poor  if(score[j] >= average + 1.5 * standarddev)
          
very poor if(score[j] <  average + 1.5 * standarddev)

perhaps after reading that you might think itd time for me to pack my bags and take up fishing or something,but I would be grateful for any help THanks

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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close