|
geo_m wrote:
Therefore this using std::queue; syntax was unknown for me, so thanx for it, it is really better than 'removing' whole namespace.
No worries. That is what these forums are for. Why all books seem to use the using namespace std; syntax is beyond me.
geo_m wrote:
so I showed my personal opinion that homework is something I have to do at my own, because only in this case it will have the required effect.
I agree that if people ask us to do their homework then we are not helping if we do it. But while I am self taught, I would not have been able to learn without books and forums like this one.
geo_m wrote:
But in any case, I still think, that my reply can be helpful
Absolutely - not least because he has the stl source on his hard drive, and there is stl documentation everywhere. Now he knows about the stl, he can check all of that out to see how a queue is implimented.
geo_m wrote:
nobody is perfect
Ain't it the truth ? I know I'm not.....
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Thanks for your comments, have amended by using a destructor, the push and pop are working fine now. Am working on the size of the queue, as this is causing a few problems.....
Then again learning a new language is all part and parcel of it, and the fun and frustrating bit.
Thanks, but I don't want you to do my homework, just pointing in the right direction is more of a help than giving the code.
Ian
|
|
|
|
|
ian_ok wrote:
Then again learning a new language is all part and parcel of it, and the fun and frustrating bit.
Too true
ian_ok wrote:
Thanks, but I don't want you to do my homework, just pointing in the right direction is more of a help than giving the code.
Ian, we've had a lot of people lately just posting their homework and expecting us to do it, but regardless of if it's homework or not, when you've had a go yourself and want some help, that's what these forums are for. I hope you feel welcome to post again if you get stuck, I know if you do I'll be happy to help and so will pretty much everyone else here.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
As I said before, yes I needed pointing in the right direction...would love to use namespace......but I've no idea what it is etc etc, still at early stages of c++.
Yes I'll post comments back to others when I have the knowledge on C++, in the mean time I'll carry on learning and you never know I'll find out how to use namespace soon!!!
I know some people just expect the answer to be wrote for them, I reply to many on a Access databases forum and I'll write a little code etc and give direction, but it is easy to spot the ones who have put in the effort and those who haven't.
Me thinks I made a reasonable effort with my code, and needed some assistance...to those who offered assistance thank you...to Gary Think before you act, or is you didn't know like me how to get the queue to work 100%, but just wanted to be childish?
Ian
|
|
|
|
|
I'd like to apologize for my earlier (now deleted) nasty post. Without reading all of your post, I reacted with a wise-ass remark that was unwarranted. It does look like you're working on a homework assignment, but you've given it the 'college try' and done the work yourself.
Despite my stupid efforts otherwise , please believe that Code Project[^] is a great place to come for help.
Good luck.
Software Zen: delete this;
|
|
|
|
|
Hi
I'm trying to create a simple mdi application using gdi+.
I've followed the directions found on another article in codeproject,
but I get the following errors:
Linking...<br />
test01.obj : error LNK2019: unresolved external symbol _GdiplusStartup@12 referenced in function "public: virtual int __thiscall Ctest01App::InitInstance(void)" (?InitInstance@Ctest01App@@UAEHXZ)<br />
test01.obj : error LNK2019: unresolved external symbol _GdiplusShutdown@4 referenced in function "protected: virtual int __thiscall Ctest01App::ExitInstance(void)" (?ExitInstance@Ctest01App@@MAEHXZ)<br />
Debug/test01.exe : fatal error LNK1120: 2 unresolved externals
I've got Visual Studio .NET running on W2k sp3 and all the GDI+ libraries, dlls, and source files are ok and properly (I guess)
referenced in the project options.
Any ideas?
|
|
|
|
|
Are you linking with gdiplus.lib?
--Mike--
"Adventure. Excitement. A Jedi craves not these things."
-- Silent Bob
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
gdiplus.lib is in the library paths.
Do I need to add any specific link options? If so, how?
And why do I get link errors with only these two functions?
Thanks in advance.
|
|
|
|
|
Hi,
I hope someone can solve this problem for me please!
I have a program in C for recording raw audio samples from the souncard into a buffer in the memory. It compiles and runs perfecty in visual studio. However when I copy the code into a VC++ program it complains about all the memory commands like malloc, realloc ect. Maybe I have to include some .lib file?? Here is some of the code that is causing the problem:
static PBYTE pBuffer1, pSaveBuffer;<br />
<br />
<br />
<br />
pBuffer1 = malloc (INP_BUFFER_SIZE) ;
error C2440: '=' : cannot convert from 'void *' to 'PBYTE'
pWaveHdr1->lpData = pBuffer1 ;
error C2440: '=' : cannot convert from 'PBYTE' to 'LPSTR'
pSaveBuffer = realloc (pSaveBuffer, 1) ;
error C2440: '=' : cannot convert from 'void *' to 'PBYTE'
Any ideas? Thanks in advance,
Paddy.
|
|
|
|
|
You need to cast the pointers to correct type, e.g.
pBuffer1 = (PBYTE) malloc(INP_BUFFER_SIZE);
|
|
|
|
|
|
I think you need to use casting - as follows:
pBuffer1 = (PBYTE) malloc (INP_BUFFER_SIZE) ;
pWaveHdr1->lpData = (LPSTR) pBuffer1 ;
pSaveBuffer = (PBYTE) realloc (pSaveBuffer, 1) ;
That should solve the compiler errors.
Scott
|
|
|
|
|
I think you need to use casting - as follows:
pBuffer1 = (PBYTE) malloc (INP_BUFFER_SIZE) ;
pWaveHdr1->lpData = (LPSTR) pBuffer1 ;
pSaveBuffer = (PBYTE) realloc (pSaveBuffer, 1) ;
That should solve the compiler errors.
Scott
|
|
|
|
|
Hi,
I am using an STL priority queue for an application. However, I want to change priorities of the entry at run-time. What is the best way to do this?
Anyone know of any good resource that deals with this?
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
thank u!
|
|
|
|
|
Recursively.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
can u t ell me more detail. such as find who is parent and who is child
|
|
|
|
|
Well, if you're recursing down every branch, then the parent is the one you just found before this one, and the child is the one you find next. Clearly if you want to rebuild a tree that you've saved to disk, you need to save not just the data, but tokens that tell you where the data goes.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Seems like lots of kids waited until the end of the holiday weekend to do their homework.
Software Zen: delete this;
|
|
|
|
|
|
faint!
|
|
|
|
|
Not sure if this has been mentioned before ...
Dictionary's definition of recursion:
See Recursion
--
Paul
"If you can keep your head when all around you have lost theirs, then you probably haven't understood the seriousness of the situation."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
i assume yr tree is just a link list.
u have to arrange all items in a consecutive chunk of memory before u attempt to serialize them. and each item should have some sort of ID to identify itself (example: nLevelID - to identify the depth of an item relative to root node, nItemID - identify the relative position of an item within a given level). This is necessary so that we u read back this memory from disk, u can interpret the memory and locate individual items and reconstruct the tree.
good lcuk
norm
|
|
|
|
|
I wrote an MFC Draw application that allows the user to draw a Line and a Rectangle. I am trying to implement 'ROTATE' for the Line and the Rctangle. Does anyone know how to rotate the Bounding Rectangle for the objects???
Doru
|
|
|
|
|
The first thing that you will need to do is represent your rectangles as a set of four points rather than two that is done with the RECT structure.
The next thing that you do is apply this rotation matrix to each point in your rectangle to rotate it, where A is the angle that you would like to rotate in radians:
cos(A) -sin(A)
sin(A) cos(A)
your final formula will look like this:
POINT pt;
POINT pt_rotated;
pt_rotated.x = pt.x * cos(A) - pt.y * sin(A);
pt_rotated.y = pt.x * sin(A) + pt.y * cos(A);
This formula is a rotation at the origin. Therefore you will need to translate the points to the origin before you rotate, then after the rotation, translate the points back.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|