Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

C++ code

Managed C++

  • Please log in to reply
1 reply to this topic

#1 sammy5g5


    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 20 February 2012 - 04:20 PM

I need some help or hints on how I get and input of the number of hours worked, and # of dependants. Plus I need to get an output of the workers gross pay, withholding amount from taxes, and the take-home pay. I have 4 numbers that are % withheld from the pay.

This is what I have so far and what I can kind of figure out.

// This program will read the number of hours worked and the number of dependants as input.
// It will also output the workers gross pay, each with holding amount, and the net take-home pay for the week.

# include <iostream>
# include <cmath>
using namespace std;

int main()
int hours;
double pay, rate;

cout<< " Enter the workers gross pay in $" <<endl;
cin>> rate;

cout<< "Enter the workers withholding amount in %" <<endl;
cin>> Withholding %;

if (hours>40);


cout<<"Hours of gross pay=" <<hours<<endl;
cout<<"Withholding percentage = % " <<withholding % <<endl;
cout<<"Weekly pay = $" <<pay << endl,

return 0;
  • 0

#2 gregwarner


    Obi Wan of Programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1586 posts
  • Location:Arkansas
  • Programming Language:C, Java, C++, C#, PHP, Transact-SQL

Posted 21 February 2012 - 06:26 AM

cin>> Withholding %;

This is not a valid statement. You need to declare a variable for the withholding percentage like you've done for the pay and the rate.
  • 0

Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid

Also tagged with one or more of these keywords: Managed C++

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download