|
led mike wrote: Use a bucket for every other letter in the alphabet. Then every letter you trip over, pour it into the right bucket.
You mean like A C E G I, etc., then I lost you?
What about the 'even' letters?
Michael
== // ==
BlueCoder
|
|
|
|
|
By 'bucket' I think he means an array of integers where each entry represents one of the letters of the string. "Pooring into the right bucket" means incrementing the count of that letter's entry in the array.
That was a good hint but I think it is best that you figure it out from there.
|
|
|
|
|
Do you recommend the boost version of a bucket or the MFC version ?
|
|
|
|
|
Thanks Rick...
Either one, if that was a question to me.
Michael
== // ==
BlueCoder
|
|
|
|
|
No, sorry. My reply was an attempt at a bad joke aimed at led mike.
|
|
|
|
|
I thought that, just after I posted.
== // ==
BlueCoder
|
|
|
|
|
Yes I failed in resisting the urge to have a go at this student
|
|
|
|
|
The string I'll be doing the algorithm on will not always be "ABCDEF"; it could be any arbitrary set of letters, and any length.
It is more difficult then I thought.
Michael
== // ==
BlueCoder
|
|
|
|
|
Michael Hildebrand wrote: It is more difficult then I thought.
Indeed. Has any of your professors discussed the danger of "assumptions" during the activities of software development? If they have not perhaps you should ask them.
|
|
|
|
|
you need to look up combinations & permutations. Wikipedia, google, math.com, doesn't matter.
|
|
|
|
|
I tried this, but only found algorithms for using all the letters. As in "ABCDEF", they return "FEDCBA", "BACDEF", etc., all 6 letters.
Michael
== // ==
BlueCoder
|
|
|
|
|
This is classical case of permutations. From your example you seem to follow an order, is that a requirement?
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Yusuf.A wrote: This is classical case of permutations. From your example you seem to follow an order, is that a requirement?
Thanks Yusuf -
No, it does not matter. Just as long as there are no 'repeats' for the group of letters being output, Like "ABC" and "CBA", would be the same thing.
Michael
== // ==
BlueCoder
|
|
|
|
|
Just to spot for you the idea...
#include <stdio.h>
#define N 6
char x[N];
char r[N+1];
int L;
void step(int k, int l)
{
if (l==L)
{
printf("%s.\n", r);
return;
}
for (int i=k; i<N; i++)
{
r[l] = x[i];
step(i+1, l+1);
}
}
void main()
{
r[L] = '\0';
for (int i=0; i<N; i++)
{
x[i]='A'+i;
}
for (L=N; L>1; L--)
{
r[L] = '\0';
step(0,0);
}
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Looking at your solution now... What is L for?
Michael
== // ==
BlueCoder
|
|
|
|
|
The current length of the sequence.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I Love you Man!
Works!
I was studying this for 4 hours!
Thanks so much!
Michael
== // ==
BlueCoder
|
|
|
|
|
Michael Hildebrand wrote: I Love you Man!
Unfortunately yours appears to be a male name...
Michael Hildebrand wrote: Works!
Thankfully.
Michael Hildebrand wrote: I was studying this for 4 hours!
That's no so much time, after all.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Yes, congratulations! You have now done is homework for him.
|
|
|
|
|
Yes, but now, he loves me...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Here's the code, and the important values from stepping through the code:
CStatic m_audio_rate_text;
...
m_audio_rate_text.Create(T_AUDIO_BITRATE_TEXT, WS_CHILD|WS_VISIBLE
,move
,this,AUDIO_BITRATE_TEXT);
CRect t;
m_audio_rate_text.GetWindowRect(&t);
How do I get the right RECT ?? (the same as the one I created it with)
Or
Why is GetWindowRect() returning a different value?
modified on Tuesday, March 24, 2009 4:33 PM
|
|
|
|
|
GetWindowRect returns a rectangle in screen coordinates. Create takes a rectangle that uses client window coordinates. You can use ScreenToClient and ClientToScreen to convert between the two.
|
|
|
|
|
Hi,
I want to write a C++/MFC application that receives jpeg pictures, adds some animation to them and then sends these frames to the Video out of the graphics card (e.g. S-Video), so that they will be outputed as analog video frames and can be displayed on a PAL/NTSC tv monitor. My question is how do I access the frame buffer so that I can copy my frames to it? How do I configure the video card driver to perform the digital to analog conversion? Do I need special hardware for this or can any video card with a tv-out do this?
Does Directx support this? Windows GDI?
Thanks,
Yair
|
|
|
|
|
Well, i believe you should be able to do something like that using DirectX, usually if your video card has an S-Video output it will either simply clone what you see on your monitor thorough VGA (or DVI) or you can choose between a few possibilites about what the card should output on the S-Video "port", clone the display, or create a second separate dekstop, or span the desktop between the two display devices (so half of your desktop is on the S-Video screen and half is on the VGA screen)... i am not sure weather you can control these settings programatically though. However, i think if you for example set up 2 separate desktops you can get access to the "secondary display's" video memory using DirectX.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
VLC does this. Download it, then run it and open a "Capture Device", it's way of saying DirectShow.
Then, depending on your version, type in
screen:
to the command line it shows at the bottom of the "open" dialog, or choose "Desktop" from a list of capture devices (same thing internally).
If you want to save it, "stream" this to a file by clicking on "stream" or the "more options" arrow and then on "stream", then entering a file name and an encoding preference in the dialog that follows.
|
|
|
|