Thread: Code problems.....once again

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    8

    Code problems.....once again

    Ok so now I'm having problems with another program I'm doing. the problem I have with this one is calculating the GPA. I think it has something to do with me do-while statement in the function where it gets the course grade. I'm not sure how to fix this though. This calculation is the only error in my code. Please somebody help me.

    I'll attach the C++ code and the program directions, if that helps.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    void main() is no good, use int main(). See the FAQ for details.

    In ConvertToNumericGrade(), tolower() or toupper() from <cctype> would make your life easier. Also, from that same function, there's no need to return LetterToNumber, as it is passed as a reference to the function. And the parameter letterGrade doesn't even need to be passed as a reference, because you never change it. Oh, and perhaps instead of hardcoding 4, 3, etc, did you mean to use the global constant doubles A, B, C, D, and F?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems with compiling code in cygwin
    By firyace in forum C++ Programming
    Replies: 4
    Last Post: 06-01-2007, 08:16 AM
  2. Problems with GetDiskFreeSpaceEx/my code...
    By scrappy in forum Windows Programming
    Replies: 1
    Last Post: 07-30-2003, 11:16 AM
  3. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 12:51 PM
  4. structs, array, code has problems, Im lost
    By rake in forum C++ Programming
    Replies: 4
    Last Post: 03-13-2002, 02:02 AM
  5. problems with output from code
    By simhap in forum C++ Programming
    Replies: 0
    Last Post: 10-08-2001, 12:43 PM