I cannot seem to get this to run, I'm self learning, so this isn't as homework assignment. My errors are on the << and -=hours worked. Any advice or pointers in the right direction would help, I feel like I am right on the edge.
Here is my Numdays.h file:
// This prevents the Console Window from closing during debug mode
// Note: Generally, you should not remove this code
cin.ignore(cin.rdbuf()->in_avail());
cout << "\nPress only the 'Enter' key to exit program: ";
cin.get();
First of all,you dont need to include ,iostream. and <cstdlib> twice.Include it in your NumDays.h file,then include that file in your main.cpp.
I also tried running your program,but it seems to be going in a loop.
When you initialize a object of a class with a constructor,you use the '.' operator to access it.
And you use the '->' operator to access a object of a class made by using pointers.
One thing I learned in doing my self projects was that when everything seemed not to work,I started from the beginning again.But this time, I checked every function I wrote before implementing it in my program.
You need to add operator<< and operator+= to your code.
For operator<<:
Changeint getHours() { return hoursWorked; }
to int getHours() const { return hoursWorked; }
and add the following after your class definition;