624 Posted Topics

Member Avatar for skatamatic

I'm making an asteroids clone game, using GDI+ in C#. I don't understand why the asteroids wont move. They are supposed to rotate based on a member indicating rotation angle, and move in a direction based off of a member that indicates movement angle. But they don't do anything at …

Member Avatar for skatamatic
0
163
Member Avatar for mtucker6784

I disagree with rashakil. Using pointers properly can greatly increase the efficiency and speed of your code. Just compare C++ to C#. C++ programs run much much faster than C#, because C# doesn't support pointers (except in strange unsafe blocks). The reason your program is crashing is because your pointer …

Member Avatar for Rashakil Fol
0
138
Member Avatar for shadowfire36

Pointer notation is slightly different than conventional array notation. It's just a syntactic issue, so I'm not afraid of doing some of your homework for you: [code=cplusplus] void ReverseArray(int* &intArray, int size) { //for each element up to "size" for (int i=size-1; i>=0; i--) { cout << "Element " << …

Member Avatar for skatamatic
0
140
Member Avatar for nickichl

That means you forgot to initialize your values when you declared them. (Usually this just throws a warning, but each compiler can be different). Just give every variable you declare a starting value, by putting it in brackets (), ie: [code=cplusplus] int iHoursWorked(0), iTime(0), etc... [/code]

Member Avatar for nickichl
0
279
Member Avatar for Emma1
Member Avatar for skatamatic
0
82
Member Avatar for skatamatic

I'm trying to right a red-eye reduction algorithm for an assignment at school. The user is asked to click on 2 eyes in an image, then the algorithm takes over and corrects the redness. The algorithm works just dandy, but I'm having a hard time capturing the actual location (in …

Member Avatar for skatamatic
0
163
Member Avatar for Speedy Hawk

I'm not sure I understand the question. Please clarify; are you wondering where to put the jpeg file itself so that it can be tested? Or are you wondering how to check if a file is a .jpg file? 1) Just call that function with a forced filename (a literal …

Member Avatar for Speedy Hawk
0
131
Member Avatar for daviddoria

[QUOTE=daviddoria;782237]Anyone know a good, simple set of classes to do thing like cartesian to spherical conversion, coordinate system transformations, etc? I wrote some of this stuff, but my code keeps breaking because of "special cases" that I have not handled. I just want to be able to use this stuff …

Member Avatar for StuXYZ
0
201
Member Avatar for AdRock

If you have to use RTTI as part of the assignment, then google it. Otherwise do as the others sugguested. Implement in the base class (the one you derived the 2 accounts from?) a virtual method that returns a bool. Now provide an override in the 2 inherited classes, one …

Member Avatar for AdRock
0
2K
Member Avatar for harryoma

What they are trying to say is, it's bad practice to exit your program spontaneously. Objects would be left undestroyed, memory orphaned, and it just doesn't look professional. Instead, use logical blocks (if/else, switch, while, etc) to stream something like that (an exit condition) towards the final return call in …

Member Avatar for harryoma
0
195
Member Avatar for serkan sendur

I don't think that would help the performance. If anything, it would just increase build time by about a few clock cycles (setting a const flag). If you actually broke down the code you write into assembly you'll see that const isn't used, it only means something to us as …

Member Avatar for skatamatic
0
69
Member Avatar for yasir Malik

Umm...and...what is the problem? And why did you create 2 accounts? That's not very good use of the server's spare resources.

Member Avatar for skatamatic
0
1K
Member Avatar for parse loki

You can't just assign a const char * to anything... You are infact assigning an address, not a temp string. And I doubt those are your intentions... Instead use strcpy() or something similar.

Member Avatar for skatamatic
0
819
Member Avatar for kevinchkin

[QUOTE=kevinchkin;782231]Geez I don't know why do people have so much attitude on this forum. I was only asking for project ideas. I wasn't asking for project or something. People on this forum are acting like, they are all Gods and it's their responsibility to make sure every human is following …

Member Avatar for skatamatic
0
108
Member Avatar for neoseeker191

I would use a bit more structure than that. Put all that crap in main into a different function, like this: [code=cplusplus] //#includes and whatnot... int main(/*arg stuff or w/e*/) { while (Menu() != true) {} return 0; } bool Menu() { //some crap from the old main() //this is …

Member Avatar for skatamatic
0
123
Member Avatar for FyerEgg

How about you don't edit your posts to tell us it's solved. How about you post your solution. That way people can learn from your mistakes. Keep editing for fixing typos and improving clarity.

Member Avatar for skatamatic
0
84
Member Avatar for ace_dman

Whats the actual question? A stack really doesn't take any implementing, non-dynamic (ie stack) variables are handled automatically (pushed and popped). There is a stack in the stl...but it's really not that useful...

Member Avatar for ace_man
0
2K
Member Avatar for Manutebecker

Well I can see a few issues with this code. First of all, when someone gets hit, i assume they would lose hp, not gain it. And as to the actual problem, the Boxer class doesn't contain a member called hp. The best way to do something like this is …

Member Avatar for Manutebecker
0
158
Member Avatar for AdRock

[QUOTE=BevoX;773955]Well, a vector or list is similar to an array. They are a kind of sequence containers, and they expect real arguments. So, you can't create a list or vector, which holds lists or vectors. Read about them: [URL="http://www.cplusplus.com/reference/stl/vector/"]http://www.cplusplus.com/reference/stl/vector/[/URL] [URL="http://www.cplusplus.com/reference/stl/list/"]http://www.cplusplus.com/reference/stl/list/[/URL][/QUOTE] That's just wrong information! A vector can hold anything - …

Member Avatar for BevoX
0
161
Member Avatar for guest7

I would just getline() each line into a vector of strings, find() the cullprit, then change it via the iterator find() returns. then output the new vector to the file. i estimate a 10 line solution or less.

Member Avatar for Comatose
0
526
Member Avatar for c++noobie

I don't think the -> operator (or the . or & operator) can be overloaded =(

Member Avatar for c++noobie
0
354
Member Avatar for guest7

Are you pushing ints into a vector, or strings? If your pushing 010 into a vector of ints your going to have issues. You're going to need to use stringstream to push numbers into a string then push those onto a vector. The binary numbers themselves can be generated with …

Member Avatar for MosaicFuneral
0
449
Member Avatar for serhannn

[QUOTE=Salem;774585]> while(addresses>>link>>name) Having got to the end of the addresses file once, where do you think you'll start off from with the second word from the keywords file? Even for a short program, your indentation is mis-leading and needs work.[/QUOTE] If you are using VS2005+ press ctrl+a+k then f. This …

Member Avatar for serhannn
0
263
Member Avatar for CoolGamer48

Hmmm the only thing I can think of is...are you sure that you are catching the exception that you think you are? Maybe there's an internal one being thrown caused by trying to load the invalid image. I've never overloaded an exception myself, so this might be a dumb question, …

Member Avatar for CoolGamer48
0
506
Member Avatar for findlay

Your map code seems fine. Maybe post more code, where s and v are declared. It seems like this wasn't copied and pasted, since there's a few program-busting spelling mistakes in it. You might want to fix those.

Member Avatar for findlay
0
130
Member Avatar for Phil++

[QUOTE=Phil++;774618]Hey, I'm trying to make a basic engine in Lua that prints out "Hello World" now I have downloaded lua and put the files include files into the same folder. But it won't compile. Is there a linker I need? Please help :( thanks[/QUOTE] You seem to have posted a …

Member Avatar for Comatose
0
80
Member Avatar for massivefermion

[QUOTE=Comatose;773140][url=http://www.letmegooglethatforyou.com/?q=C%2B%2B+md5+hash]Maybe?[/url][/QUOTE] Haha what a sweet website.

Member Avatar for skatamatic
0
78
Member Avatar for iaaan

[QUOTE=marco93;774571]No, it's a very bad example, because grid controls are native in Win32 and you don't need to re-invent the wheel. And here, it's not a grid, but a lv.[/QUOTE] Nothing wrong with re-inventing the wheel, so long as its either better or you learned something from it.

Member Avatar for skatamatic
0
624
Member Avatar for kashyapanirudh

Depends on what you're capable of! You should make it as challenging for yourself as possible without being unreasonable. Our final project is a 4 player tank shooting game played over a LAN using DirectX, perhaps you could do something similar?

Member Avatar for skatamatic
0
95
Member Avatar for monere

[url]http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt[/url] Alot of info on the mp4 file layout.

Member Avatar for skatamatic
0
103
Member Avatar for cppnewb

Notepad++ is great for many code languages. It's much more lightweight than VC++, but it lacks alot of features (particularly a debugger and compiler/linker =P )

Member Avatar for John A
0
137
Member Avatar for nitrooreo

The reason for using const modifiers is for situations like this: [code=cplusplus] Point const X(5, 2, 3); Point Y(0, 0, 0); Y = X; [/code] Since x is a const, the previous version of your code will not work, but the new one will. But this isn't likely what fixed …

Member Avatar for nitrooreo
0
310
Member Avatar for michaelmorris

How about...don't read the file twice!! It's practices like this that cause execssive wear on harddrives. Why not load everything in the file into memory (an array/vector)? You will find that RAM has much better read/write times than your harddrive...

Member Avatar for michaelmorris
0
325
Member Avatar for u8sand

What does the default constructor look like (the one with no arguments). That could be causing a problem. Please post more specific code (the actual class perhaps?) and the incorrect result you are getting (error message? wrong output?). It is good c++ practice to always initialize an object with its …

Member Avatar for u8sand
0
99
Member Avatar for rajesh_pec

Lol. If you're going to ask people to do your homework for you, at least give a reasonable description of what it is you are supposed to do! (But still...don't ask people to do homework for you...) . Is this object oriented? Are you using a certain class/struct for the …

Member Avatar for skatamatic
0
106
Member Avatar for philzz

[code=cplusplus] cin.ignore(cin.rd_buf()->in_avail()); cin.get(); [/code] Slap that on the end of the code. This will do the following: ignore all the available input from the cin (console) input buffer, then grabs a null terminated character (basically waits until you hit enter).

Member Avatar for skatamatic
0
197
Member Avatar for drkessence

ummm....lol. What a rediculous objective. Is this to be console based? No graphics whatsoever? If it is console based, I'd say that the contest is much too easy and find it hard to believe that an award is really being offered.

Member Avatar for drkessence
0
203
Member Avatar for drjay1627

Is recursion really necessary for this? Whenever possible avoid using it. It's inefficient, hard to implement, and hard to debug. It seems as though the function recursively calls itself until it is at the end of the list, then it displays a line. In each recursive call, you should be …

Member Avatar for skatamatic
0
182
Member Avatar for nvodapally

Show some effort by posting some of your own code. I'm not even sure what mergesort is supposed to do.

Member Avatar for skatamatic
0
79
Member Avatar for skatamatic

Well, this is for the same assignment as my last post. It's just a simple implementation of a bunch of Algorithm functions. It throws a runtime exception at the end saying the stack around the b variable was corrupted! I commented out all the lines with that use the b …

Member Avatar for skatamatic
0
136
Member Avatar for skatamatic

I'm working on an assignment for school where my teacher wants me to convert each member of an array of a class if it's int member is greater than 300. I can make it work for the first value of 300, since that's what find_if returns. But how do I …

Member Avatar for skatamatic
0
190
Member Avatar for techgenie

Why are you passing an array to displayLottery (in the declaration), it's not used in the method? Also, when you set the lottery you are only setting index # 6. And if you had properly passed your array from main it would be an out of range index (which will …

Member Avatar for skatamatic
0
285
Member Avatar for chamaca24

You weren't very clear, and that isn't very easy to read, but i think you're building a sentinel loop. [QUOTE][code=cplusplus]while (choice != 'A' && choice != 'B'&& choice != 'C' && choice != 'D') { cout << "You must enter A, B, C, or D.\n"; cin >> choice;[/code] }[/QUOTE] There's …

Member Avatar for skatamatic
0
150
Member Avatar for Syrus_Jones

Hmmm it seems your using a while loop to check if the input was valid. I would just throw an exception: [code=cplusplus] if (number <= 0) throw exception ("Invalid number"); //now do the factor testing loop for (int factor(2); factor <= (number / 2); ++factor) if (number%factor == 0) cout …

Member Avatar for skatamatic
0
818
Member Avatar for laki234

lol...you wan't people to go through all that code and find what your having problems with? I think you should be more specific as to what the problems are, and maybe post a more relevant piece of the code.

Member Avatar for MosaicFuneral
0
117
Member Avatar for Blackout22

And for the second function, it will require an int argument. Make it something like this: [code=cplusplus] void Play(int); //declare it int main() { //call it Play(Menu()); ... } //define it void Play(int iChoice) { //put the switch here } [/code]

Member Avatar for skatamatic
0
121
Member Avatar for Trekker182

Hmmm perhaps you should be comparing to position - 1, since 0 is counted. While something may be in 3rd in the list, it would be counted as 2nd since position starts at 0. Position will always equal the pos due to the above loop. I think a simple else …

Member Avatar for Trekker182
0
133
Member Avatar for mybluehair
Member Avatar for skatamatic
0
110
Member Avatar for skatamatic

For a lab, my instructor asked us to include an assignment operator with our class, but to hide it. Does this mean to declare it as private and just leave an empty implementation? Is this common/useful?

Member Avatar for wt1099
0
313
Member Avatar for skatamatic

I'm writing a function parser, which (hopefully) will be able to handle much more complex problems than basic operations. I've just completed the handling of the addition, subtraction, and brackets, but am at a loss of how to implement proper order of operations for multiplication and division. In order to …

Member Avatar for skatamatic
0
199

The End.