I am writing a game in which I need to know whether or not a user preforms an action in one second or less. I can not use time() because it measures time in seconds. If the user starts the action half-way through a second it would mess with accuracy. I am experimenting with clock(). I have got clock to work with some programs to make a delay, but not in this way to measure time: [CODE] #include <iostream> #include <ctime> using namespace std; int main() { clock_t start = clock(); cout << "press enter..."; cin.ignore(); clock_t finish = clock(); …

Member Avatar
Member Avatar
+0 forum 12

Hi all, I am trying to create a class to serve as a customized cout class. Right now I have made some test code to see if I can do it. Right now I am trying to make it function just like cout, but later I will have it do more than just print text to the screen. Currently my class works when I try and print one item, but not multiple ones. The code: [CODE=c++, operator.cpp]#include "operator.h" using namespace std; void printclass::operator<<( const string & mesg ) { cout << mesg; } int main() { printclass print; print << …

Member Avatar
Member Avatar
+0 forum 2

Hi, I was wanting to write a (ba)sh script to allow me to wait for the detection of a new USB device, and when that device is detected, execute some commands. The scripts are intending to be working on the principle that whenever I plug in a usb device a message containing the words "new" and "USB" is appended to /var/log/messages. I want this program to be running in the background of my computer at all times, so I want one that will take as little cpu power as it can when there is nothing for it to do. I …

Member Avatar
Member Avatar
+0 forum 2

I am adding a secondary hard drive to my dell tower. I am wanting to duel boot Windows XP and Slackware Linux. I currently have only Windows XP on my computer, but I am not sure what formating it has on it. My question is: what format should I use on the secondary drive for Linux? Does it need to be the same as the format on the primary drive? Thanks in advance :)

Member Avatar
Member Avatar
+0 forum 3

I have two questions relating to classes. I have run into a problem in using classes in multi-file programs. Here are three example files which illustrate the problem I am having and the errors I am getting. [B]file1.cpp[/B] [CODE=c++] //file1.cpp #include<iostream> #include"file3.h" using std::cout; using std::cin; namespace baz { extern MyClass foobar; } int main() { baz::foobar.setFOO(); baz::foobar.bar(); cout << *baz::foobar.FOO << "\n"; cin.ignore(); return 0; } /*errors: In function `main': [Linker error] undefined refference to `baz::foobar' [Linker error] undefined refference to `MyClass::setFOO()' [Linker error] undefined refference to `baz::foobar' [Linker error] undefined refference to `MyClass::bar()' [Linker error] undefined refference to …

Member Avatar
Member Avatar
+0 forum 9

The End.