Hi all, I'm looking for some help and I am way way new. As in school and not able to do my stupid homework.
I'm trying to #include "TimeOfDay.h" and using code::blocks.
I have the TimeOfDay.h file in place, as well as the TimeOfDay.cpp, and main.cpp
It's telling me on line 6 of main.cpp that there is no file or directory TimeOfDay.h
I've tried them in the same dir as main, and in the directories code blocks decided to stick them on creation.
//******************************************
// A program to create two time objects
// and manipulate them.
//******************************************
#include <iostream>
#include "TimeOfDay.h" // For TimeOfDay class
usingnamespace std;
int main()
{
TimeOfDay time1(5, 30, 0); // Instantiate two TimeOfDay objects
TimeOfDay time2;
int loopCount;
cout << "time1: "; // Print them and compare them
time1.Write();
cout << " time2: ";
time2.Write();
cout << endl;
if (time1.Equal(time2))
cout << "Times are equal" << endl;
else
cout << "Times are NOT equal" << endl;
time2 = time1; // Set them equal
cout << "time1: "; // Print them and compare them
time1.Write();
cout << " time2: ";
time2.Write();
cout << endl;
if (time1.Equal(time2))
cout << "Times are equal" << endl;
else
cout << "Times are NOT equal" << endl;
time2.Increment(); // Increment one, print and compare
cout << "New time2: ";
time2.Write();
cout << endl;
if (time1.LessThan(time2))
cout << "time1 is less than time2" << endl;
else
cout << "time1 is NOT less than time2" << endl;
if (time2.LessThan(time1))
cout << "time2 is less than time1" << endl;
else
cout << "time2 is NOT less than time1" << endl;
TimeOfDay time4(23, 59, 55); // Instantiate one near the maximum
cout << "Incrementing time1 from 23:59:55:" << endl;
for (loopCount = 1; loopCount <= 10; loopCount++)
{
time4.Write();
cout << ' ';
time4 = time4.Increment(); // Check that it overflows properly
}
cout << endl;
return 0;
}
Actually, I just solved my problem. I had tried moving the .h to the same directory as main before, but I was copying. When I deleted the .h file from the include directory it worked.