Thread: how do i find the score?

  1. #1
    Unregistered
    Guest

    how do i find the score?

    can somebody please help me with this:
    the question is
    how many tests did you give to the class?
    and you put a number
    then i have to find the average of the tests for a particular student
    but i dont know how many tests the other is goin to enter
    so my formula doesnt work
    can you help? in any way?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Sum all the results of that particular student, then divide by the number of tests that student have made...

    ...if I understand your quite unclear question...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    39

    using cin

    well,the code will be something like this!

    void main()
    {
    int total_tests;
    cin>>total_tests;
    average=total_numbers/total_tests;
    }
    once a kohatian,always a kohatian!

  4. #4
    Registered User blight2c's Avatar
    Join Date
    Mar 2002
    Posts
    266
    do you mean something like this?

    Code:
    int scores, number;
    cout<<"how many?";
    cin>>number;
    cout<<"what are the scores?";
    for (int i=0; i<number; i++)
    {
    int reply;
    cin>>reply;
    scores += reply;
    }
    cout<<scores/number

  5. #5
    Unregistered
    Guest

    Thumbs up thanks a lot

    thanks all of you but i tried it how blight2c had the code and it gave me the right answer, thank you
    i was tryin to figure that out for hours and i couldnt, it finally got into my nerves and i decided to post it, i didnt think that somebody would reply but they did and thanks again

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    22

    Cool nice one

    looks like blight is tha man lol.
    - Visual C++, Adobe Photoshop -

  7. #7
    Registered User blight2c's Avatar
    Join Date
    Mar 2002
    Posts
    266
    i don't get it, what's so funny?

  8. #8
    Registered User
    Join Date
    Apr 2002
    Posts
    22
    um, i guess what is funny was how perfectly you answered his question.

    i didn't mean any offense by it though. lol don't want to start out my time in this forum making enemies.
    - Visual C++, Adobe Photoshop -

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. C program using structs to calculate grades
    By TampaTrinDM88 in forum C Programming
    Replies: 4
    Last Post: 07-06-2009, 12:33 PM
  3. Frustated with mess table printing
    By benedicttobias in forum C Programming
    Replies: 6
    Last Post: 04-16-2009, 05:50 PM
  4. help on dropping score.
    By jchopki in forum C Programming
    Replies: 4
    Last Post: 09-21-2008, 06:54 PM
  5. how do u find 2nd largest number??
    By juancardenas in forum C Programming
    Replies: 8
    Last Post: 02-14-2003, 08:28 AM