278 Posted Topics

Member Avatar for iammfa

I think what necrolin says is the way to go. Don't underestimate the fact that while you are writing games you are still learning C++, you won't stop learning when you start applying it ( as a matter of fact I think you'll never stop learning C++ ). But of …

Member Avatar for necrolin
-1
182
Member Avatar for Kingfahad

Did you even try anything yourself to find the solution? The question sure looks like a homework assignment, which is not something you'll get help for here unless you show that you've actually tried and frankly I don't believe that you have. So do the following: Search for 'for loop' …

Member Avatar for thelamb
-1
91
Member Avatar for duke.tim
Member Avatar for Nick Evan
0
261
Member Avatar for thelamb

Hello all, I have a VB.net application and a C++ DLL. The C++ DLL has an exported function that gets called by the VB.net application. The C++ exported function is as following: [CODE=cpp] STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); TR::Log( "Starting …

Member Avatar for thelamb
0
2K
Member Avatar for jefanot

Learn about scopes. You have more than 1 line of code 'inside' your while loop, but how does the compiler know which code is inside the while loop? You do not tell the compiler how many lines are inside the while loop, so the compiler assumes that there is only …

Member Avatar for William Hemsworth
0
119
Member Avatar for dgr231

Get ready to slap yourself in the face dgr. You're defining the applicants variable as a local variable (a variable is only valid between the brackets ( { } ) where it is defined in. [code=cpp] try { applicant *applicants = new applicant[num]; } [/code] After the } the applicants …

Member Avatar for gotorightway123
0
1K
Member Avatar for kentigens

A vector has a lot of functions associated with it that you can use, including removing elements (erase): [url]http://www.cplusplus.com/reference/stl/vector/[/url] You should read up on vector iterators, they are really handy to use. Google is your friend here. Of course if you don't understand something about it you can always ask …

Member Avatar for thelamb
0
174
Member Avatar for Acute

You can keep a pointer to a b1 object in the passenger class. So when a passenger 'spawns' you set one of the building objects in the passenger class. Then you can call p1.building->ComeGetMe(); I think the building should then take care of calling the elevator function, because only the …

Member Avatar for Acute
-2
126
Member Avatar for kernel>panic

And how exactly do you expect us to help you? I doubt anyone is going through your source(I could be blind but I don't even see any) to pinpoint for you where your bottlenecks are. There exist 'code profilers' that can show you what section of your code is taking …

Member Avatar for mrnutty
0
155
Member Avatar for jeezcak3++

My experience in learning a language has always been doing. Of course the learning-style differs per person but I can only give you my view. From when I was young(I still am, but younger ;P) I was always in interested in programming, I tried to start a few times but …

Member Avatar for thelamb
0
143
Member Avatar for komyg

The same answer applies to that and is specific to the driver you are talking about. If the driver only has one version, for Linux, then you probably wont run into any problems, if there exist different versions for different distros then you might run into problems, but in this …

Member Avatar for NicAx64
0
179
Member Avatar for dzhugashvili

When I started out with c++ I did some projects on projecteuler.net. I was always printing my results(in a while loop) untill one day I didn't do this and was blown away by how much faster the calculation was. So if you're going to print a lot you should ask …

Member Avatar for dzhugashvili
0
323
Member Avatar for tarekwehbe

Why do you expect others to do your homework? This approach will never work out on these forums. Instead show us that you have done some effort and explain what you are having problems with. You say you have fixed 4 out of 16 problems, that means all the other …

Member Avatar for mrnutty
0
129
Member Avatar for iamsmooth

First of all, you are not closing the 'fin' stream, but this is not the cause of your problems. Let's check what is happening: You create a Message object, which in its constructor opens a file and reads from it. After that the file is closed. A second instance of …

Member Avatar for thelamb
0
116
Member Avatar for J@ckel

It indeed depends on how the LPDIRECT3D9 is defined, normally you will find a structure definition like: [code] struct _MYSTRUCT { [indent]int myInt; string myString; [/indent] } myStruct, *pmyStruct; [/code] And then (I think just as a matter of preference) you can define something like LPMYSTRUCT as a pointer to …

Member Avatar for thelamb
0
142
Member Avatar for abby2589

Just because it says line 211 doesn't mean that that is the exact position of the error. And what exactly doesn't make sense about this error? The compiler was reading through your code and it reached the end, but there still was a { that you didn't close (every { …

Member Avatar for thelamb
0
129
Member Avatar for tomtetlaw

This is not an error that comes up because of syntax errors in your code. You shouldn't write the class implementation in the .h file, the compiler is expecting to find a cbaseclass.cpp file somewhere, but it doesn't. So create a cbaseclass.cpp, include the .h file and copy/paste the implementation …

Member Avatar for thelamb
0
128
Member Avatar for 23.12.2012

You don't NEED to implement the game's classes with C++ classes, but this is a typical case where object oriented programming(using classes) comes in handy. There isn't a single-best way to something like this but if you decide to use C++ classes you could decide to make a: - "common" …

Member Avatar for 23.12.2012
0
104
Member Avatar for laconstantine

[code] void (*PHook)(void); // 1 PHook = (void*)(0x00131000); // 2 PHook(void) // 3 { cout << "Bye"; } [/code] The first error is on line //3, you forget the return type of the PHook function. But all-together what you are doing isn't going to work out, if you're looking at …

Member Avatar for Ancient Dragon
0
184
Member Avatar for azjherben

And give us some more information on what exactly isn't working, are there errors or? Secondly, the way you use select() will only work with one socket, what if you want to have more clients connecting to your proxy? Select() returns the number of sockets that are ready, so if …

Member Avatar for azjherben
0
172
Member Avatar for xcktinios

You're question (to me) isn't very clear. Can you show us what you have done so far (including a better explanation of what you think has to be done) and point out with what exactly you are having problems.

Member Avatar for StuXYZ
0
91
Member Avatar for RoninMastaFX

It seems indeed that is what he is trying to accomplish. However, RoninMastaFX when you think about this problem logically, there must be a better way than defining variables with all possible case-variations. What I think you have in mind is this: A user types in the string "pi" (or …

Member Avatar for jephthah
0
135
Member Avatar for Pavan_

The std namespace isn't defined in a header that you need to include, the compiler knows where to find it without you specifying it, much like it knows what an int is, without you implicitly telling it. So it will even depend on the compiler where exactly the std namespace …

Member Avatar for Salem
0
218
Member Avatar for RiceFiend

Your code works fine for me, except that you do not flush the input buffer, so the Remove function doesn't wait for my input on the getline call, it straight passes the getline (because there is 'garbage' in the input stream). After that the search returns my added item correctly. …

Member Avatar for StuXYZ
0
135
Member Avatar for athlon32

Also depends on how much you are printing. Using endl can significantly slow your code if you are printing alot. As an example when I started out with c++ I did some exercises on projecteuler.net, constantly printing in a while loop, I was blown away when at some point I …

Member Avatar for athlon32
0
278
Member Avatar for ItecKid

[code=c++] int main() { int* a = new int[2]; func(a); delete[] a; } void func( int* a ) { // Do something with a }[/code]

Member Avatar for thelamb
0
107
Member Avatar for thelamb

Hello all, I am coding a client/server in C++ - everything is working so far but I was wondering if my approach is correct or if there is a better way of handling this: In this version only 64 clients need to be able to connect, in a different application …

Member Avatar for thelamb
0
182
Member Avatar for manoj gangula
Member Avatar for manoj gangula
0
52

The End.