Advertisement
andrefecto

temp is weird

Nov 17th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. using namespace std;
  5. int main(){
  6. // Declarations
  7. double hoursWorked;
  8. double temp;
  9. double counted;
  10. double running;
  11. // Initalizations
  12. hoursWorked = 0;
  13. counted = 0;
  14. running = 0;
  15. // Input
  16. for (counted = 0; counted < 5; counted++)
  17.         {
  18.             cout << "Please enter the amount of hours worked on day " << counted << ": ";
  19.             cin >> hoursWorked;
  20.             running = hoursWorked + temp;
  21.             temp = running;
  22.             cout << endl;
  23.             cout << "just for testing temp value: " << temp << endl;
  24.             cout << "just for testing hoursWorked: " << hoursWorked << endl;
  25.         }
  26. // Process
  27. // Output
  28. // Prolouge
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement