Click here to Skip to main content
15,902,896 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Combination Algorithm Pin
led mike25-Mar-09 5:14
led mike25-Mar-09 5:14 
GeneralRe: Combination Algorithm Pin
Michael Hildebrand24-Mar-09 11:31
Michael Hildebrand24-Mar-09 11:31 
GeneralRe: Combination Algorithm Pin
led mike25-Mar-09 5:20
led mike25-Mar-09 5:20 
AnswerRe: Combination Algorithm Pin
bulg24-Mar-09 11:30
bulg24-Mar-09 11:30 
GeneralRe: Combination Algorithm Pin
Michael Hildebrand24-Mar-09 11:36
Michael Hildebrand24-Mar-09 11:36 
AnswerRe: Combination Algorithm Pin
Yusuf24-Mar-09 11:38
Yusuf24-Mar-09 11:38 
GeneralRe: Combination Algorithm Pin
Michael Hildebrand24-Mar-09 11:41
Michael Hildebrand24-Mar-09 11:41 
AnswerRe: Combination Algorithm Pin
CPallini24-Mar-09 11:47
mveCPallini24-Mar-09 11:47 
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);
  }	
}


Smile | :)

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]

GeneralRe: Combination Algorithm Pin
Michael Hildebrand24-Mar-09 11:53
Michael Hildebrand24-Mar-09 11:53 
GeneralRe: Combination Algorithm Pin
CPallini24-Mar-09 11:57
mveCPallini24-Mar-09 11:57 
GeneralRe: Combination Algorithm Pin
Michael Hildebrand24-Mar-09 12:11
Michael Hildebrand24-Mar-09 12:11 
GeneralRe: Combination Algorithm Pin
CPallini24-Mar-09 13:34
mveCPallini24-Mar-09 13:34 
GeneralRe: Combination Algorithm Pin
led mike25-Mar-09 5:12
led mike25-Mar-09 5:12 
GeneralRe: Combination Algorithm Pin
CPallini25-Mar-09 5:31
mveCPallini25-Mar-09 5:31 
QuestionQuick Easy MFC question [modified] Pin
bulg24-Mar-09 10:26
bulg24-Mar-09 10:26 
AnswerRe: Quick Easy MFC question Pin
Rick York24-Mar-09 11:09
mveRick York24-Mar-09 11:09 
QuestionHow to send video frames to the Video Out in the graphics card Pin
ben002724-Mar-09 8:56
ben002724-Mar-09 8:56 
AnswerRe: How to send video frames to the Video Out in the graphics card Pin
Code-o-mat24-Mar-09 9:22
Code-o-mat24-Mar-09 9:22 
GeneralRe: How to send video frames to the Video Out in the graphics card Pin
bulg24-Mar-09 10:39
bulg24-Mar-09 10:39 
GeneralRe: How to send video frames to the Video Out in the graphics card Pin
ben002724-Mar-09 12:14
ben002724-Mar-09 12:14 
GeneralRe: How to send video frames to the Video Out in the graphics card Pin
Code-o-mat24-Mar-09 22:44
Code-o-mat24-Mar-09 22:44 
GeneralRe: How to send video frames to the Video Out in the graphics card Pin
ben002725-Mar-09 7:37
ben002725-Mar-09 7:37 
QuestionA question about SDI architecture ... Pin
Joseph Marzbani24-Mar-09 7:04
Joseph Marzbani24-Mar-09 7:04 
QuestionRe: A question about SDI architecture ... Pin
David Crow24-Mar-09 7:09
David Crow24-Mar-09 7:09 
AnswerRe: A question about SDI architecture ... Pin
Joseph Marzbani24-Mar-09 7:12
Joseph Marzbani24-Mar-09 7:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.