Thread: Can Someone Help Me Plz!!!

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    1

    Question Can Someone Help Me Plz!!!

    Write a C program that will assist with the student advisement process at a college. The program will provide the user with the following main options:
    1. To calculate and display a student”¦s current GPA (Grade Point Average) given the grade obtained by the student in each course completed so far.
    2. To calculate and display the student”¦s projected GPA given:
    a. The grades that the student hopes to achieve in the new courses to be done in the coming semester.
    b. The student”¦s current GPA.
    c. The number of courses that the student has completed so far.

    Notes
    ƒę This program is concerned with GPA calculation in general ”V the names of courses are not important.
    ƒę Each college course is worth 3 credits.
    ƒę Quality points are assigned to grades as follows:
    o A 4.0
    o B 3.0
    o C 2.0
    o D 1.0
    o F 0.0
    ƒę Appropriate messages are to be displayed in the following cases:
    o A student”¦s current GPA is below the minimum of 2.0
    o A student”¦s projected GPA is below the minimum of 2.0
    ƒę For each main option the user must be allowed to repeat the calculation as many times as desired.
    ƒę The user must always have the ability to return to the main menu to make another choice.
    ƒę Option 2 must be available as an immediate follow-up to option 1 and also as an independent option.


    This is what i have so far:


    #include <stdio.h>
    #include <stdlib.h>
    #include <conio.h>
    #include <ctype.h>

    void main()
    {
    char grade;
    float qualitypoints,tqp,cgpa,tc;
    int count,coursecomp,crd,sum;

    while(grade!='x'){
    printf("Please enter grade obtained or 'x' to quit: ");
    scanf("%c", &grade);
    while(getchar()!='\n');
    }

    switch (grade) {
    case 'a': qualitypoints=4.0;
    case 'A': qualitypoints=4.0;
    break;
    case 'b': qualitypoints=3.0;
    case 'B': qualitypoints=3.0;
    break;
    case 'c': qualitypoints=2.0;
    case 'C': qualitypoints=2.0;
    break;
    case 'd': qualitypoints=1.0;
    case 'D': qualitypoints=1.0;
    break;
    case 'f': qualitypoints=0.0;
    case 'F': qualitypoints=0.0;
    break;
    default: printf("Invalid Grade!!!\n");
    break;
    }

    sum=0;
    while(grade=='x'){
    qualitypoints=grade;
    grade=grade+1;

    printf("Total quality points are: %2.2f\n",qualitypoints);
    }


    while(grade!='x'){
    printf("Please enter grade obtained: ");
    scanf("%c", &grade);
    while(getchar()!='\n');
    }


    system("PAUSE");
    }


    and it is not workin!!
    i need a while statement that when a is enter it will recognize that 'a' is worth 4.0 quality points!!!

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    main never returns void. It always returns an integer. Anyone who says otherwise is wrong.

    Use code tags, or don't post code. Read the FAQ andt he sticky message at the top of the forum.

    Code:
     while(grade!='x'){
    printf("Please enter grade obtained or 'x' to quit: ");
    scanf("%c", &grade);
    while(getchar()!='\n');
    }
    This is not what you want. It's close, but it's in the wrong spot. You want to do something like this:
    Code:
    do
        display menu
        read from keyboard
        clear trailing newline character
        pass argument to switch statement
            default case is invalid choice
            case x is for exiting
            other cases modify appropriate grade
    while selection is not x
    There's your basic outline. That should clear up the problems you're having.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can any1 plz make this assignment
    By jean in forum C Programming
    Replies: 17
    Last Post: 05-13-2009, 09:19 PM
  2. plz help me...
    By sweetchakri in forum C Programming
    Replies: 1
    Last Post: 03-03-2009, 11:50 PM
  3. [Request] Need Help Plz
    By TylerD in forum Tech Board
    Replies: 4
    Last Post: 01-03-2009, 09:54 AM
  4. Anyone plz help me
    By Rose_Flowers in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 09-17-2003, 12:01 PM
  5. help plz plz
    By nsssn73 in forum C++ Programming
    Replies: 2
    Last Post: 06-03-2002, 08:44 AM