Search:
Type: Posts; User: Paul McKenzie
Search:
Search took 3.64 seconds.
-
Don't return a short int. Return a LONG. You should be returning and passing Windows API types, so that you don't get into the trouble where
sizeof(Windows Type) != sizeof( C++ type )
The...
-
January 22nd, 2015, 01:53 PM
One thing that your code lacks that I believe has not been mentioned is that the class lacks an assignment operator. Otherwise, you can't write code like this:
vmString s1="x";
vmString s2;...
-
January 4th, 2015, 10:26 PM
1) Are you debugging a release build or a debug build?
2) This:
pMeshContainer->pBoneMatrices = new D3DXMATRIXA16[g_NumBoneMatricesMax];
does not default initialize the members of the struct....
-
December 17th, 2014, 12:49 AM
Why don't you use std::list instead of your home-made List class?
Regards,
Paul McKenzie
-
December 3rd, 2014, 09:21 AM
1) Your read loop does not check if it goes over 500 entries.
2) Why are you writing your own sort function, when you could use just std::sort?
There is a big difference between "compiling fine"...
-
November 13th, 2014, 09:28 PM
One way to learn is to take the code I posted, compile it, and step through it with a debugger. You will see it gives you the correct results, all without loops. It almost uses no logic, except...
-
November 13th, 2014, 02:02 PM
Just for the heck of it, I coded this up. I won't go into how it works, since this is supposed to be homework.
However, I posted it to illustrate what can be accomplished using the various...
-
November 13th, 2014, 01:10 PM
For example, here is a breakdown of cont1 and cont2, according to your description:
cont1 = {4,34} {76,4} {3,5} {6,7} {67,19} {37,59} {38,33} {98,31} {12,19} {87,45}
cont2 = {32} {98} {3} {55}...
-
November 13th, 2014, 12:56 PM
So take that data you posted -- what should the output be? Even better, show us with a smaller sample.
Regards,
Paul McKenzie
-
November 13th, 2014, 12:45 PM
You need to clarify what is meant by "repeating". You have a pair of numbers -- by "repeating" are you talking about the two numbers in the pair? Or pairs that have the same data? See the...
-
November 13th, 2014, 12:34 PM
for (chk2 = cont3.begin(); chk2 != cont3.end(); chk2++)
That one line of code shows that chk2 does refer to the cont3 vector. It is an iterator into that vector. The replacing function messes up...
-
November 13th, 2014, 12:31 PM
Another thing you should do -- start out with 5 or 10 numbers, not 50. That way, bugs can be easily worked out with a smaller set of input values.
Regards,
Paul McKenzie
-
November 13th, 2014, 12:16 PM
One thing I see that is clearly wrong is that you're changing a vector while you're using iterators from that vector to loop.
for (chk2 = cont3.begin() ; chk2 != cont3.end(); chk2 ++)
...
-
November 13th, 2014, 12:01 PM
Run the program under the debugger -- that is what anyone here would do to solve the problem, so you must learn how to do this. Now would be a good time to learn.
Also, just because a program...
-
November 4th, 2014, 09:17 PM
Division by 0 is not a standard C++ exception, so there is nothing to "catch" since nothing is thrown.
Regards,
Paul McKenzie
-
October 22nd, 2014, 05:19 AM
Honestly, your assignment doesn't make sense, even if you can't use vector.
You're creating a dynamic array in main, but then you just call resize() which basically boils down to doing nothing. ...
-
October 16th, 2014, 10:19 AM
Unless it is a container such as std::map, you should strive to not erase elements in a container while you're looping over the same container. I have seen too many code examples where the coder is...
-
October 7th, 2014, 05:16 AM
It does not free the memory that you allocated.
Ask yourself this -- how would a std::set<char*> know that the pointer that is there points to dynamically allocated memory? It doesn't know.
...
-
October 1st, 2014, 04:05 AM
From 4.11.2 of the ANSI standard:
Regards,
Paul McKenzie
-
September 30th, 2014, 11:07 PM
Doesn't compile here:
http://ideone.com/TbDZg2
Regards,
Paul McKenzie
-
September 30th, 2014, 04:27 AM
Please post the output you're getting now, plus the input you're using.
Second, just to warn you -- floating point calculations when done on a binary-based system such as a computer will not be...
-
September 30th, 2014, 04:23 AM
I highly recommend you use a dual monitor for debugging GUI issues, where Visual Studio is on one monitor, and your application is on the other monitor. Or get a very large monitor and...
-
September 2nd, 2014, 04:44 PM
If a static library is built with _SECURE_SCL=0, the all libraries that link to it that use STL must be built with the same setting.
As to your code "working" on OS and not another machine --...
-
August 27th, 2014, 08:33 PM
It isn't just a "good practice". You cannot allow exceptions to leave a destructor, period. Therefore you have no choice but to catch anything before the destructor completes.
-
August 27th, 2014, 07:44 PM
How are you suspending the thread? If you're using SuspendThread, that shouldn't be used for synchronization.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686345%28v=vs.85%29.aspx
...
|
Click Here to Expand Forum to Full Width
|