Click here to Skip to main content
15,886,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Multiple .cpp files Pin
Emilio Garavaglia6-Apr-10 20:36
Emilio Garavaglia6-Apr-10 20:36 
QuestionPermutations with repetition Pin
MsmVc5-Apr-10 20:59
MsmVc5-Apr-10 20:59 
AnswerRe: Permutations with repetition Pin
CPallini5-Apr-10 21:49
mveCPallini5-Apr-10 21:49 
GeneralRe: Permutations with repetition [modified] Pin
MsmVc5-Apr-10 21:58
MsmVc5-Apr-10 21:58 
GeneralRe: Permutations with repetition Pin
CPallini5-Apr-10 22:06
mveCPallini5-Apr-10 22:06 
GeneralRe: Permutations with repetition Pin
MsmVc5-Apr-10 22:07
MsmVc5-Apr-10 22:07 
GeneralRe: Permutations with repetition Pin
MsmVc6-Apr-10 0:00
MsmVc6-Apr-10 0:00 
GeneralRe: Permutations with repetition Pin
CPallini6-Apr-10 0:21
mveCPallini6-Apr-10 0:21 
My advice is: go recursive.

However, I guess you need an example:
#include <stdio.h>
#include <string.h>
void step(char sSeq[], int len, char sOut[], int level, const int depth)
{
  for (int i=0; i<len; i++)
  {
     sOut[level-1]= sSeq[i];
     if ( level == depth)
       printf("%s\n", sOut);
     else
       step(sSeq, len, sOut, level+1, depth);
  }
}

int main()
{
  char  sSeq[]="ABC";
  int len = strlen(sSeq);
  const int DEPTH = 3;
  char sOut[DEPTH+1]={'\0'};
  step(sSeq, len, sOut, 1, DEPTH);
  return 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]

GeneralRe: Permutations with repetition Pin
MsmVc8-Apr-10 0:42
MsmVc8-Apr-10 0:42 
GeneralRe: Permutations with repetition Pin
CPallini8-Apr-10 3:25
mveCPallini8-Apr-10 3:25 
QuestionCFile Dialog Crash on Window Server 2008. Pin
Le@rner5-Apr-10 18:22
Le@rner5-Apr-10 18:22 
AnswerRe: CFile Dialog Crash on Window Server 2008. Pin
KarstenK5-Apr-10 22:42
mveKarstenK5-Apr-10 22:42 
GeneralRe: CFile Dialog Crash on Window Server 2008. Pin
Le@rner7-Apr-10 20:49
Le@rner7-Apr-10 20:49 
GeneralRe: CFile Dialog Crash on Window Server 2008. Pin
KarstenK7-Apr-10 22:38
mveKarstenK7-Apr-10 22:38 
QuestionStack overflow Pin
browneyes865-Apr-10 16:00
browneyes865-Apr-10 16:00 
QuestionRe: Stack overflow Pin
David Crow5-Apr-10 16:31
David Crow5-Apr-10 16:31 
AnswerRe: Stack overflow Pin
Luc Pattyn5-Apr-10 16:52
sitebuilderLuc Pattyn5-Apr-10 16:52 
GeneralRe: Stack overflow Pin
Tim Craig5-Apr-10 18:20
Tim Craig5-Apr-10 18:20 
GeneralRe: Stack overflow Pin
Luc Pattyn5-Apr-10 18:31
sitebuilderLuc Pattyn5-Apr-10 18:31 
GeneralRe: Stack overflow Pin
Luc Pattyn5-Apr-10 18:31
sitebuilderLuc Pattyn5-Apr-10 18:31 
GeneralRe: Stack overflow Pin
CPallini5-Apr-10 21:27
mveCPallini5-Apr-10 21:27 
GeneralRe: Stack overflow Pin
Tim Craig6-Apr-10 8:31
Tim Craig6-Apr-10 8:31 
GeneralRe: Stack overflow Pin
CPallini6-Apr-10 9:23
mveCPallini6-Apr-10 9:23 
AnswerRe: Stack overflow Pin
Adam Roderick J5-Apr-10 19:02
Adam Roderick J5-Apr-10 19:02 
QuestionRe: Stack overflow Pin
browneyes867-Apr-10 4:27
browneyes867-Apr-10 4:27 

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.