Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Showing results 1 to 20 of 20
Search took 0.01 seconds.
Search: Posts Made By: Monster
Forum: C Aug 17th, 2005, 2:15 PM
Replies: 11
Views: 383
Posted By Monster
Single quotes = octal number Double quotes =...

Single quotes = octal number
Double quotes = string
Forum: C Aug 16th, 2005, 3:00 PM
Replies: 6
Views: 496
Posted By Monster
If using DOS and a compiler using the textcolor...

If using DOS and a compiler using the textcolor function:

#include <stdio.h>
#include <conio.h>

int main(void)
{
textcolor(MAGENTA);
cprintf ("Hello world\n");
return 0;
Forum: C++ Apr 22nd, 2005, 5:15 AM
Replies: 12
Views: 289
Posted By Monster
gets is evil, use fgets instead!

gets is evil, use fgets instead!
Forum: C Apr 8th, 2005, 6:51 AM
Replies: 7
Views: 276
Posted By Monster
This is not strange at all. You must allocate...

This is not strange at all. You must allocate memory before you can free it.
If you crete a character pointer (char *neu;) it is pointing to some undefined memory location.

b.t.w. you can use neu...
Forum: C Apr 5th, 2005, 6:54 AM
Replies: 5
Views: 397
Posted By Monster
Just a small note: 1. Do not use the fflush...

Just a small note:

1. Do not use the fflush function on input buffers, this is undefined behaviour.

2. Never use the gets function, use the fgets function instead.

To flush the input buffer, you...
Forum: C++ Mar 20th, 2005, 1:06 PM
Replies: 17
Views: 389
Posted By Monster
That's something you can turn off. Goto Project...

That's something you can turn off.

Goto Project Settings (Alt+F7) then select the C/C++ tab.
Select Category: Precompiled Headers
Now select: Not using precompiled headers
Forum: C++ Mar 8th, 2005, 4:14 AM
Replies: 9
Views: 290
Posted By Monster
What about a recursive function? void...

What about a recursive function?

void print_digits(int number)
{
int temp = number%10;
if(number = number/10)
{
print_digits(number);
cout << " " << temp;
}
Forum: Visual Basic Mar 7th, 2005, 3:54 AM
Replies: 2
Views: 209
Posted By Monster
Data Type Summary...

Data Type Summary (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vagrpDataType.asp)
Forum: C++ Feb 9th, 2005, 1:14 PM
Replies: 1
Views: 186
Posted By Monster
The first enter is from the read_command function...

The first enter is from the read_command function of the parent.
Forum: C++ Feb 8th, 2005, 1:27 PM
Replies: 15
Views: 1,029
Posted By Monster
Last compiler error: remove the #include...

Last compiler error: remove the #include "player.h" in monster.h

You also need to implement the set_health(int) and get_armor() functions in Monster.cpp
Forum: C++ Feb 8th, 2005, 1:21 PM
Replies: 15
Views: 1,029
Posted By Monster
I have made some changes to the code (in red)....

I have made some changes to the code (in red). It's now reduced to 1 error:
error C2061: syntax error : identifier 'monster'

You need to add a function to Monster.h: int get_bonus_damage();
And...
Forum: C++ Feb 7th, 2005, 4:50 PM
Replies: 15
Views: 1,029
Posted By Monster
I'm still missing a closing bracked in the shop...

I'm still missing a closing bracked in the shop function.
The } just after this->update_stats(); is the closing bracked of the for loop. You need an extra to close your function.
Forum: C++ Feb 7th, 2005, 4:44 PM
Replies: 15
Views: 1,029
Posted By Monster
Are you sure, because that's exactly what the...

Are you sure, because that's exactly what the compiler tells you: local function definitions are illegal

I have added and extra } just before the int player::fight(monster *m) function and it...
Forum: C++ Feb 7th, 2005, 4:38 PM
Replies: 15
Views: 1,029
Posted By Monster
void player::shop() needs an extra closing...

void player::shop() needs an extra closing bracked (the for loop).


b.t.w. I don't get the first error on monster
Forum: C++ Feb 7th, 2005, 4:22 PM
Replies: 15
Views: 1,029
Posted By Monster
Must be something in monster.h Can you post the...

Must be something in monster.h

Can you post the monster.h code?

There is no replacement for unistd.h. Some of it is defined in io.h or sys/types.h but not all of it.
Forum: C++ Feb 5th, 2005, 3:16 PM
Replies: 5
Views: 325
Posted By Monster
Another example. In the first example you create...

Another example. In the first example you create an array with 30 FooClass objects. In this example you create an array with 30 pointers to FooClass objects. To add a FooClass, you need to allocate...
Forum: C++ Feb 5th, 2005, 3:08 PM
Replies: 5
Views: 325
Posted By Monster
You beat me... just changed it to an array.

You beat me... just changed it to an array.
Forum: C++ Feb 5th, 2005, 2:34 PM
Replies: 5
Views: 325
Posted By Monster
main() { int i=30; FooClass* pFoo; pFoo...

main()
{
int i=30;
FooClass* pFoo;

pFoo = new FooClass [i];
pFoo[0].fooString="Foobar Quux";
delete[] pFoo;
return 0;
}
Forum: C++ Jan 28th, 2005, 11:09 AM
Replies: 11
Views: 792
Posted By Monster
You are (almost) correct. The values are not...

You are (almost) correct. The values are not passed correctly to the separate function.

That's because you are passing the complete struct. What the program will do is create a copy of the struct...
Forum: C++ Jan 23rd, 2005, 2:00 PM
Replies: 3
Views: 239
Posted By Monster
To prevent generating the same random numbers...

To prevent generating the same random numbers each time you start the application, call the srand function before the rand function:
#include <cstdlib>
#include <iostream>
#include <ctime>

using...
Showing results 1 to 20 of 20

 
Forum Jump



DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:14 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC