Thread: grade program code

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    2

    grade program code

    whts the code for this program
    make a program that displays the percentage of students who passed by getting a d or better and the number who failed by getting an e or f. use Z as the value of the sentinel, making surenot to count the Z as a grade.

  2. #2
    ^ Read Backwards^
    Join Date
    Sep 2005
    Location
    Earth
    Posts
    282
    whts the code for this program
    That would be the information you type in proper syntax to try and produce a program that does what you said. That is what the code is.
    http://cboard.cprogramming.com/annou...ouncementid=39

  3. #3
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155
    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
        cout << "make a program that displays the percentage of students who passed by getting a d or better and the number who failed by getting an e or f. use Z as the value of the sentinel, making surenot to count the Z as a grade." << endl;
        return 0;
    }
    yeh i know its been done before, but i couldnt resist.

  4. #4
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    Oh, come on guys, give him a break. I don't have a compiler here at work, but I think this should get you going on the right track.

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
        int studentGrade[45] = {89,79,85,32,15,65,82,5,69,32,65,
                                78,32,25,73,68,73,79,30,84,46,32,
                                31,68,79,17,32,89,79,85,9,82,32,79,
                                87,78,20,32,87,79,24,82,15,75,46};
        const int passing = 32;
        char sentinel = 'd';
        double studentTotal = 36;
        int passed = 0;
    
        while  (!(1 ||(1 && 0)))
        {
            cout << "The following students passed: " << endl;}
        for (int i=0; i!=45; ++i)
            {
                if (studentGrade[i] >= passing && sentinel != 'z')
                {
                    char passed = studentGrade[i];
                    cout << passed;
                }
            }
    	cin.get();
    	return 0;
    
    
        cout << "That means " << passed/studentTotal << "% passed the class." << endl;
    
    }
    *edit* corrected the code, should compile now.
    Last edited by Decrypt; 11-17-2005 at 06:23 PM.
    There is a difference between tedious and difficult.

  5. #5
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155
    By asking

    >> whts the code for this program

    I dont think he is looking for help, or to get

    >> going on the right track.

    so I will let it up to you to

    >> ... give him a break.

    IMO, If you are going to ask someone to do your homework for you, atleast ask in a clever way...

    my 2.3 cents

  6. #6
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    I totally agree, xhi. That's why I wrote the program. (Take a closer look at the code.)
    There is a difference between tedious and difficult.

  7. #7
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155
    lol. Gold star for you Decrypt!

    [applause]

  8. #8
    Super Moderator Harbinger's Avatar
    Join Date
    Nov 2004
    Posts
    74
    > whts the code for this program
    I'm sure your effort so far will get a well deserved 'F'

  9. #9
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    [applause]
    Thank you....I'm here all week.
    There is a difference between tedious and difficult.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How Can I compile 3 source code in 1 program ?
    By lord_cedrich in forum C Programming
    Replies: 8
    Last Post: 12-10-2006, 05:10 AM
  2. My program needs less code.
    By shish789 in forum C Programming
    Replies: 16
    Last Post: 05-14-2004, 06:51 PM
  3. Please test my program: Code Black
    By PhoenixC++ in forum Windows Programming
    Replies: 15
    Last Post: 04-29-2004, 07:18 PM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM