daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204
" boost/timer.hpp: No such file or directory. "
You'll need to download and build the library from http://www.boost.org/ . Some of the facets of the library can be used with just the headers (as they are self-contained) but you'd still have to make sure you had all the dependencies (the headers include other headers, etc.). I'm not sure what the case is with Timer.
See http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html (or if you need the *nix version it's the next page in.
It may be painful to install and get working the first time
I found this to be true also, but if it's what you need then go for it.
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 581
Wait how is boost timer supposed to help? He wants to time the input from the user.
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 581
@OP would you settle for something like this :
int main(){
Timer timer; //Timer is some class that does timing stuff
string input;
timer.start();
getline(cin,input);
long milliSec= timer.getMilliSeconds();
timer.reset();
const int ALLOWED_TIME = 3000; //milli seconds
if(milliSec > ALLOWED_TIME){
//tell user time had passed
}
else{
//input was in time
}
}
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
For that code (at programmer's heaven) you'll have to include conio.h (if your compiler includes it, many will not,which comes with all the caveats of being non-standard) and include ctime to get the time function.
In that code they are taking a whole character array in, so you don't need most of it.
Try out the _kbhit in a couple of "toy" programs first, then add in the timing. See what you can come up with and post your code for this section and we can take a look.
...and no need to be sorry. This is just one of those areas where there's no clean way to do it is all.
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 581