repetitive work

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2008
Posts: 4
Reputation: kjsalk is an unknown quantity at this point 
Solved Threads: 0
kjsalk kjsalk is offline Offline
Newbie Poster

repetitive work

 
0
  #1
Oct 13th, 2008
1,hi i need to create a program that will repeat the following 14 times.it needs to provide keyboard input that takes in hours worked in a day.after the 14 time it needs to show the hours worked.
2,the rate of pay is 6 pounds 50 pence. it needs to provide the gross pay on screen for those two weeks.
3,it needs to provide their gross pay for one year assuming they get the same every two weeks.
4,it needs to provide the yearly net pay taking off 20% tax & 5% national insurance
if anyone can help me out with this i would be very gratefull, i am a total beginner and this is for the course i am on and am really struggling#cheers john
  1. #include "stdafx.h"
  2. #include "iostream"
  3. using namespace std;
  4.  
  5. int main(void)
  6.  
  7. float fTotal=0;
  8. float fHoursworked=0;
  9. float fPay=6.5;
  10. float cYear=26;
  11. cout <<"please enter the your hours worked today\n";
  12. for (int idays = 0);idays;<14;idays;+=1)
  13. }
  14. cin >> fHoursworked;
  15. fTotal += fHoursworked;
  16.  
  17. cout <<"the total number of hours worked is"<<fTotal<<"\n";
  18. fTotal = fTotal*fPay;
  19. cout <<"the total number of hours worked is"<<fTotal<<"\n";
  20. fTotal= fTotal* cYear;
  21. cout<<"the total number of hours worked is"<<cYear<<"\n";
  22. return 0;
this is where i'm at lots of errors can't work it out
Last edited by Ancient Dragon; Oct 13th, 2008 at 9:28 am. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,661
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1500
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning

Re: repetitive work

 
0
  #2
Oct 13th, 2008
Work through the error messages one at a time. The first error is normally what's wrong. Correct that error then recompile -- you will get a lot fewer error messages that way.

For example: line #2 of the code you posted is probably wrong. System header files are enclosed in < and > brackets, not quotes. #include <iostream>
line 12: you have an extraneous ; just before the += operator

line 13: you used the wrong brace -- should be { instead of }, and your program is missing the matching }
  1. for (int idays = 0);idays;<14;idays +=1)
  2. {
  3. cin >> fHoursworked;
  4. fTotal += fHoursworked;
  5. }
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 273
Reputation: Sci@phy will become famous soon enough Sci@phy will become famous soon enough 
Solved Threads: 42
Sci@phy's Avatar
Sci@phy Sci@phy is offline Offline
Posting Whiz in Training

Re: repetitive work

 
0
  #3
Oct 13th, 2008
Several syntax mistakes:
1. Missing opening bracket after main()!
2. Missing opening bracket after for (instead you have closing bracket on line 13.)!
3. Missing closing for-bracket.
4. Missing closing main() bracket!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum


Views: 328 | Replies: 2
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC