TriggaMike's Profile User Rating: -----

Reputation: 85 Whiz
Active Posts:
1,103 (0.41 per day)
26-September 08
Profile Views:
Last Active:
User is offline Apr 30 2014 06:32 PM

Previous Fields

OS Preference:
Who Cares
Favorite Browser:
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:

Latest Visitors

Icon   TriggaMike has left the building. Look for me elsewhere.

Posts I've Made

  1. In Topic: collision detection

    Posted 27 Apr 2014

    One piece of advice:

    Try making a function to test for rect collisions specifically that takes two rects and returns a Boolean.

    This will make your logic far easier to read, will open up options for you coding wise.
  2. In Topic: Array in class without number of elements

    Posted 11 Apr 2014

    Since this is an exam question, maybe they were looking for a different approach to solve the problem of indexing in an array without a size?

    I think a relatively easy solution would be to use the theory behind Cstring and simply tack on a null terminator after your last point of data, so the code would be like:

    Class Plane
    /*unaltered code*/
    Plane :: Plane(int MT, int NMB, string passengers[]){
    	motors = MT;
            int number = NMB; // why assign instead of just using NMB
    	list = new string[number + 1]; // Increase the size of the array by one
    	for (int i =0; i<number; i++) // Left this loop unchanged
            *(list + number) = NULL; //Added code to append a NULL terminator
    void Plane :: PrintPassengers()
    	for (int i=0; *(list+i) != NULL ; i++)    //The test is now simply scanning for NULL
    	cout << *(list+i) << endl;

    I'm fairly certain that would have been a reasonable solution to your problem. I'm fairly new to C++ so I'm not 100% sure that this *(list+i) != NULL line will do exactly what I'm looking for, but I'm pretty sure it should.
  3. In Topic: clock() returning 0, for some odd reason

    Posted 9 Apr 2014

    Disclaimer: I am not a C++ expert

    I think your problem is that you're casting an integer value to a float/double

    The clock() function returns processor ticks which should always be a whole value. You can't have a partial tick, either 1 tick goes by, or 2 ticks or 2000 ticks. This method should never think that 2.5 ticks has gone by.

    Try casting to int/long and see what happens.
  4. In Topic: Using a single header to manage imports

    Posted 9 Apr 2014

    EDIT: Alright, Thanks Jim!

    This is what I was worried about.

    So is the only downside to preprocessor macros the loss of type safety? The reason I define that macro as such is that I am working on this project with another developer, and I want a log statement for each of us so our debug messages don't spit out at the other dev when working. I used a similar macro in Objective-C and XCode for a long time and never had issues with it.

    How can I define two debug statements that will only print messages based on an environment variable or something similar using inline? Could you provide an example?
  5. In Topic: No operator error.

    Posted 9 Apr 2014

    Strings are not primitive data types so you cannot use boolean operators on it.

    Try replacing your line with


    strcmp reference

    EDIT: Wrong method, my bad

My Information

Member Title:
Using up all your 1's and 0's
Age Unknown
September 24
Calgary, Alberta, Canada
Guitar, Guitar Hero, Rockband, Video games in general, programming, things involving science or programming, or the two combined.
Years Programming:
Programming Languages:
Java(intermediate), C(beginner), C++(novice), Python(beginner)


Page 1 of 1
  1. Photo

    jelskie Icon

    06 Feb 2012 - 18:54
  2. Photo

    gabehabe Icon

    03 Mar 2011 - 03:52
    Are you dead?
  3. Photo

    jelskie Icon

    20 Jan 2011 - 01:47
    hai you
  4. Photo

    Imdsm Icon

    25 Aug 2010 - 10:45
    Do we get a cookie? who do we have to speak to to redeem this offer?
  5. Photo

    no2pencil Icon

    15 Mar 2010 - 21:02
  6. Photo

    coden4fun Icon

    18 Feb 2010 - 02:15
    I like your profile pic being a facepalm.
Page 1 of 1