expert pls help me on this...running out of time

This is a discussion on expert pls help me on this...running out of time within the C Programming forums, part of the General Programming Boards category; You are required to write a complete C program for a simple grading system. At the beginning of the system, ...

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    19

    Red face expert pls help me on this...running out of time

    You are required to write a complete C program for a simple grading system. At the beginning of the system, you need to input number of students and number of subjects that have been marked. Then, you need to enter the student's identification number and marks for each subject. While entering the marks, you have to determine their respective grades and display the grades based on the following table:

    problem with the input and output...number of student and subject isn't appear as entered..

    what should i do to make the num of students and subjects appears as input...

    i m a beginner no knowledge on array, struct and pointer huh...i've done till loop, while statement
    ple help...

    #include <stdio.h>

    void main(){
    float average,total_mark;
    int noStud, StudID, noSub;
    int num1, num2 , num3;

    printf("\t\t\tGrading System\n\n");
    printf("Enter no. of student: ");
    scanf("%d", &noStud);
    printf("Enter no of subject: ");
    scanf("%d", &noSub);
    printf ("\n\n\t>>Enter students ID:");
    scanf ("%d" , &StudID );
    printf ("\n\t>>Enter marks for %d:\n" , StudID );


    printf ("\tEnter mark for subject English: ", &num1);
    scanf("%i", &num1);
    if (num1 >= 80 && num1 <= 100)
    printf ("\tGrade: A\n");
    else if ((num1 >= 70 && num1 <=79))
    printf ("\tGrade: B\n");
    else if ((num1 >=60 && num1 <=69))
    printf ("\tGrade: C\n");
    else if ((num1 >= 50 && num1 <=59))
    printf ("\tGrade: D\n");
    else if ((num1 >= 40 && num1 <=49))
    printf ("\tGrade: E\n");
    else if ((num1 >=0 && num1 <=39))
    printf ("\tGrade: F\n");

    printf ("\tEnter mark for Mathematic: ", &num2);
    scanf("%i", &num2);
    if (num2 >= 80 && num2 <= 100)
    printf ("\tGrade: A\n");
    else if ((num2 >= 70 && num2 <=79))
    printf ("\tGrade: B\n");
    else if ((num2 >=60 && num2 <=69))
    printf ("\tGrade: C\n");
    else if ((num2 >= 50 && num2 <=59))
    printf ("\tGrade: D\n");
    else if ((num2 >= 40 && num2 <=49))
    printf ("\tGrade: E\n");
    else if ((num2 >=0 && num2 <=39))
    printf ("\tGrade: F\n");

    printf ("\tEnter mark for Science: ", &num3);
    scanf("%i", &num3);
    if (num3 >= 80 && num3 <= 100)
    printf ("\tGrade: A\n");
    else if ((num3 >= 70 && num3 <=79))
    printf ("\tGrade: B\n");
    else if ((num3 >=60 && num3 <=69))
    printf ("\tGrade: C\n");
    else if ((num3 >= 50 && num3 <=59))
    printf ("\tGrade: D\n");
    else if ((num3 >= 40 && num3 <=49))
    printf ("\tGrade: E\n");
    else if ((num3 >=0 && num3 <=39))
    printf ("\tGrade: F\n");

    total_mark=num1+num2+num3;
    printf ("\nTotal Marks = %.2f\n", total_mark);
    average=total_mark/noSub;
    printf ("Average Marks = %.2f\n" ,total_mark/noSub);
    if ( average >= 40)
    printf ("PROCEED TO THE NEXT SEMESTER....\n");
    else if (average <=39)
    printf ("FAIL TO THE NEXT SEMESTER....\n");


    system("pause");
    return 0;



    }
    Last edited by scorpio76; 10-26-2010 at 09:31 AM.

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Edit your post and put code tags around that code if you want anyone to read it.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 03-14-2009, 02:03 PM
  2. Running time
    By wu_weidong in forum Tech Board
    Replies: 1
    Last Post: 09-05-2005, 04:03 PM
  3. running time for memchr()
    By axon in forum C++ Programming
    Replies: 5
    Last Post: 12-04-2003, 10:50 AM
  4. I apologize. Good bye.
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 05-03-2002, 06:51 PM
  5. relating date....
    By Prakash in forum C Programming
    Replies: 3
    Last Post: 09-19-2001, 09:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21