if you are looking for a stopwatch, consider <chrono>. If you want date and time, I think ctime is still the go-to tool, but I don't do date-time manipulation very often.
in the code I add #include<ctime> but it still doesn't work
then you need to explain better.
do you have some custom alternate files with odd names? If so, follow dutch's advice.
if its ctime as your title indicated, what 'didnt work'. Did it fail to compile? Did it compile but crash when you run it? Maybe it ran but gave weird answers.
your question is effectively: "I wrote a program and it did not work. Why not?!".
#include <iostream>
usingnamespace std;
#include "ccc_time.h"
int main()
{ Time now;
Time day_end(23, 59, 59);
long seconds_left = day_end.seconds_from(now);
cout << "There are " << seconds_left
<< " seconds left in this day.\n";
return 0;
}
Why this code doesn't work and it gives me an error [Error] ccc_time.h: No such file or directory
The problem with ("ccc_time.h") has already been covered except to say that this file should be in the current working directory when running the program. This should be different subdirectories depending on how you run the program.
Before I get into why the previous post has such a large number and what I have learned I need to know if you have figured it out or not.