Are you talking about where I say "Unit units[100]" in the definition of the "UnitCollection" class? Because the compiler says the error is in the "UnitCollection" constructor, but I never call the...
Type: Posts; User: cjmdjm
Are you talking about where I say "Unit units[100]" in the definition of the "UnitCollection" class? Because the compiler says the error is in the "UnitCollection" constructor, but I never call the...
Thanks for the help guys. I have started work on this program again after a busy week of other commitments. Using your advice, I have cleared up most of the problems. The program is a realtime...
Ok, thanks, that clears things up with arrays. And I probably should have read the article you linked to before posting lol. But one more question. When passing in objects (instances of classes)...
Hi all,
I learned C/C++ a long time ago in high school, and since then I have been working mainly in java. Now I am doing a C++ project again, and I have set up a system of classes and structures...
So, I just spent the last 3 or 4 hours fixing a bug in a program of mine. The program would compile, but then immediately crash as soon as it started running, with no explanation. The compiler gave...
Ok, I found the preprocessor directives tutorial on this site and that is helping with a lot of this. I didn't know these things were called preprocessor directives so at first I didn't know there...
In the above code, why #define SOMEFILE_H, and not #include SOMEFILE_H? Perhaps I don't understand the difference between include and define. And the #endif goes at the very end of the header file?...
Awesome thanks guys. On a completely unrelated note, my program is starting to get really long, with lots of class and function declarations ahead of the main function. I was thinking of separating...
So if I don't use "new" does it not call the constructor? Because I was using Daved's method, but I want the constructor to be called, to initialize the position and orientation data.
Thanks.
Ok, so both tabstop and Daved's solutions work fine. Thanks guys. But, in the interest of bettering my understanding of classes/pointers, what exactly does the "new" keyword do? I thought to...
So I am working on a software based 3d engine. I have a structure called triangle, and a class called object. The object class contains an array of triangles that make up that object, and...
Already did it, quite awhile ago actually. In visual c#, with graphics handled via the windows GDI. I put in a timer object, which fired a timer event every few milliseconds. Each time the timer...
Wow dude, I downloaded the source to Geany, one of the .tar.gz files, and its huge. I am trying to find the actual code files (ie, .c or .cpp) to open in my compiler. I am trying to find the file...
Could be a good idea. Usually I work on small projects for a few days and then get bored with them, I have rarely done a long term project, and rarely work with other programmers. I am good with...
Recently I have been bored and have been writing random programs just for fun (and for practice). Mostly simple projects that can be finished in a day or two.
But Im running out of ideas. First...
I have a tic tac toe program. The board is stored in a two dimensional character array board[3][3]. Here is a function that is supposed to check if the player specified in the player argument wins....
For a little challenge exercise i was doing i had to come up with a program that would take a decimal number as input and output it in binary form (ie 36 = 100100). I was successful in doing this,...
I'm a relative newbie to C++ myself, but here is my suggestion. Have the user input the letter and store it in a char variable (with cin >> char_variable). Then have the user enter their name and...
I have a number in a string (actually its a character array, c style string) and i want to put it in an integer variable. The character array simply contains one a digit in each index and then, of...
Wow i didn't know you could declare a string as, well, a string. I thought strings had to be declared as character arrays (ie char string[50]). Is there a different include file (other than...
I have a program with two strings. I want to copy part of the first string, up to the first space character in that string, into a separate string. Here is the section of code i wrote that is...
I have just started learning C/C++. As practice i started doing a few challenge exercises. I am working on one such exercise in which i must write a program which can decide if three given points...