Thread: What's wrong with this code?

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    4

    What's wrong with this code?

    Code:
    if(HrsWrked <= 40 ){
          (GrPay= HrsWrked * 4.50);
          }
          
     else if(HrsWrked > 40 && <= 44.99){
           (GrPay= HrsWrked * (4.50*1.5));
           }
    
      printf("%.2f is Your Gross Pay",GrPay); 
    
    system ("pause");
    It's part of a larger payrate program

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Syntax error, perhaps?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    4

    but where?

    wheres the error?

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Code:
    else if(HrsWrked > 40 && ░░<= 44.99){
    Add HrsWrked to the spot marked in red, above.

  5. #5
    Registered User
    Join Date
    Jan 2010
    Posts
    4
    got it, nvm

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What's wrong with my code?
    By x2x3i5x in forum C Programming
    Replies: 6
    Last Post: 09-28-2009, 11:52 AM
  2. what is wrong in this simple code
    By vikingcarioca in forum C Programming
    Replies: 4
    Last Post: 04-23-2009, 07:10 AM
  3. what is wrong with this code please
    By korbitz in forum Windows Programming
    Replies: 3
    Last Post: 03-05-2004, 10:11 AM
  4. I cant find what is wrong with this code
    By senegene in forum C Programming
    Replies: 1
    Last Post: 11-12-2002, 06:32 PM
  5. very simple code, please check to see whats wrong
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 10-10-2001, 12:51 AM