>> Concept: Shouldn't classes only change their own data?
In the example I used a global variable just as an example. The real use I'm putting this to is using a class to wrap a complicated tree...
Type: Posts; User: tigs
>> Concept: Shouldn't classes only change their own data?
In the example I used a global variable just as an example. The real use I'm putting this to is using a class to wrap a complicated tree...
Hi,
Is it possible to have a reference in a class?
Here is an example:
class MyClass {
public:
MyClass(); // Constructor
int& y; // Reference (line 16)
Hi,
I have a lib file made with MS VC++ which I want to try and port to Dev-C++, which uses the MingW compiler. I tried using the reimp MingW utility on it, but it didn't successfully convert it...
I kinda need to get it to work with command strings, the easiest way to explain it is that the user types in their own command string which is passed to MCI.
I get MMSYSTEM device in use errors if I...
I think it is possible, but using MCI command strings, how can you play more than one sample at a time?
I have searched for quite some time on MSDN and it goes no further than how to play a sample,...
Dynamic 2D array of longs:
// Malloc returns a pointer to the beginning of the array you just initialised
// (long*) is a typecast telling the compiler that malloc is returning a pointer to an...
The technology in those multimedia programs is advancing fast, you can do some pretty amazing stuff quickly in them these days. However, at the end of the day, a programming language offers ultimate...
If you have a number which won't change throughout the program, why not just use a #define?
#define diamonds 1
What is the advantage of const int over a define?
int getkey(void)
{
// Get ASCII code of charactor hit
int key = getch();
// ASCII code of hit is 224 - get second getch() to retrieve code of other keys e.g. arrow keys
if (key == 224) {...
Multimedia fusion, the next version of The Games Factory. It's not bad, but not too flexible. You can write additional objects for it in C++, which I have done, to make life a little easier.
...
My preferred method:
long *array = (long*) malloc(width * height * sizeof(long));
then to access, use like a one dimensional array
array[(y * width) + x] = 4;
When done (MUST do this at end...
Huh? If you actually PLAY it, you'll notice it's definitely NOT the TA engine... I didn't make it in C++ anyway, one of those multimedia build-it-all-together programs, so it's a bit crappy and...
SetDlgItemInt? You can only SetDialogItemText on a string, can't you?
Try an itoa() to turn an integer to a string.
Not done in C++, but mleh :)
Terminal Orbit Real Time Strategy
Two more pics if you're interested
Don't worry, I think I may as well just move on to Win32 API because consoles are ugly and limited...
So I'll have a good read of that tutorial and ask some more specific questions later if...
To work out by brute force:
Start looping at the lowest of the two given numbers multiplied by two. Loop every number up to the product of the two numbers.
In the loop, if you modulus the...
Hi,
I've been experimenting a bit with the Windows Console and with a bit of searching I can now set text colour and position the cursor anywhere on the screen to write text, get keyboard input...
0-9 is ASCII 48-57. a-z is ASCII 97-122.
Generate a random number 0-36, if it's 0-9 convert that to an ASCII 0-9 (add 48). If it's 10 or over add 87. The result should be a char of 0-9 or a-z.
Isn't a char -128 to 127? So something with an ASCII value of 28 would come out -100. Unsigned char (or byte) is 0-256 I think.
There's a text compression contest on the cprogramming.com main site. Is that still running?
But if you did, say:
puts("Press any key to start");
would the "start" in that string be replaced by a {?
Or does the preprocessor not replace inside strings?
I know it's not a good idea to...
Success for setting a pixel in a DOS window!
I attached to this message 'setpixel.c'
In a DOS window in mode 13h it draws a little smiley face out of a few set pixels :) compiles in Turbo C.
...
Well, I have it, and I'm not entirely sure how to use it. I read the readme's, extracted it all ect. and DJGPP, Turbo C and Dev C++ can't compile anything with #include "allegro.h" in it. It goes...
Thanks... but all I see (with Turbo C) is a single ASCII char in the top left... the other compiler gives syntax error on '*' and 'vga'. What was that code meant to do? Clear the screen?
I...
I find a good way of seeing an ASCII char from its value is
printf("%c",200);
where 200 is the ASCII value.
I tried some hex values and still couldn't find any double-line-to-single-line box...