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 fairly confident with Python, and am now turning my focus from learning how to program the language to learning to program it well. I am wondering what the best way to approch classes which have too many variables in them. I an writing a platformer game, and, though it works fine, I am trying to clean up the code. My `Player` class is especially messy. Here is an example: class Player(obj.PhySprite): warp = None #this stores the function to change levels. It should take the #same arguments as the Level class #counters: shards = 0 #shards …

Member Avatar
Member Avatar
+0 forum 2

I have a slackware 13.1 tower computer and an Ubuntu 10.04 netbook. The netbook has an Atheros AR9285 wireless adapter, and I just recently got a Netgear WG111v3 USB wireless for the tower. I got the ndiswrapper driver working for the Netgear, and I have been previously been using the Ubuntu wifi without problem. My goal is to get an ad-hoc lan set up between the two computers, and it seems that I have almost succeed. The laptop says it is connected, but neither computer can ping the other. Here is what I did. On the tower: [CODE]# ifconfig wlan0 …

Member Avatar
Member Avatar
+0 forum 1

Hi all, I have a Pentium 4 with hyper-threading on my Slackware machine. Currently I am running the non-SMP 2.6.24.5 kernel, but I want the option to be able to boot with the 2.6.33.4 SMP kernel as well. I already have Lilo installed on my computer and have a large variety of kernels installed. What I want to know is how I should edit my /etc/lilo.conf file and what kernel I should use: huge/generic? currently my lilo.conf file looks like this: [CODE]# LILO configuration file # generated by 'liloconfig' # # Start LILO global section boot = /dev/hda #compact # …

Member Avatar
+0 forum 0

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.