CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Feb 2011
    Posts
    4

    Question C++ Formula Error - Confusing Output

    I have attached the c++ code file and the header file I'm using to compile it.
    The program has to take in employee details, and work out a wage slip from there.
    The problem is from line 112 - 120, when the hours & overtime must be entered together.
    Any hours over 37.5 need to be separated and declared as a separate variable. Then multiplied by the rate of pay. The variables must be declared separately because they are both used separately, they go on to multiply by separate rate of pay, the output for this is also spewed out like garbage! Apart from that the program runs fine and put out all the right figures.
    Any help will be greatly appreciated!


    if ( customers[row].hours < 37.5 )
    {
    customers[row].ohours = customers[row].hours - 37.5;
    customers[row].hours = 37.5;
    }
    else if (customers[row].hours > 37.5 )
    {
    customers[row].hours = customers[row].hours;
    customers[row].ohours = 0;
    }
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured