storing in an array

Hello,
I am new to C++ and I wanted to get the output from the following code. My objective is to get all permutations of DNA words for a given number of letters. (numLetter=4 in this case). Now I want to save these DNA words to an array somewhere so that I can use them for some other computations. I tried many hours, but couldn't figure it out. Any help would be appreciated.
Thanks,


#include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

void displayPermutation(string permutation[], int length){
int i;
string ArrayLetters[(short)pow(4.0,(double)sizeof(permutation))];
string dnaCase="";
for (i=0;i<length;i++){
dnaCase+=permutation[i];
}
cout<< dnaCase<<endl;
}

void getPermutations(string permutation_[], int numLetter_, int curIndex_){
int i;
string dnaBases[] = {"A","C","G","T"};
string dnaCase="";
//stop recursion condition
if(curIndex_ == numLetter_){
displayPermutation(permutation_,numLetter_);
for(int j=0;j<4;j++){
}
}
else{
for(i = 0; i <4; i++){
permutation_[curIndex_] = dnaBases[i];
getPermutations(permutation_,numLetter_,curIndex_+1);
}
}
}

int main ()
{
int numLetter =4 ;
int curIndex = 0;
string permutation[numLetter];
getPermutations(permutation,numLetter,curIndex);
return 0;
}
gd
Topic archived. No new replies allowed.