g++ waste.cpp
waste.cpp:6: error: ISO C++ forbids declaration of `start' with no type
waste.cpp:6: error: conflicting types for `int start'
waste.cpp:5: error: previous declaration as `time_t start'
waste.cpp:7: error: ISO C++ forbids declaration of `end' with no type
waste.cpp:7: error: conflicting types for `int end'
waste.cpp:5: error: previous declaration as `time_t end'
waste.cpp:9: error: syntax error before `while'
what could be wrong? if there's a better way to do this, please suggest.
Thank you much!
I think the compiler is confused - your code, as posted, looks reasonable. It looks like the compiler has already seen start referenced before. start is not a reserved word in C++. It also looks like variables are declared.
As always, thank you so much Driver!
Yes, I am a newbie and still learning by way through trying out different applications.
I just wanted a small program to waste cpu and yes portability a concern here. But i'll take up on your suggestion on trying it out with sleep()
Ooooops. I assumed that was a snippet, not the whole thing...
All C, C++ code requires main() somewhere. That's the place where the program starts running.