Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21348

writing c++ codes to vb

$
0
0
Hi all
I have a code from the site : http://ideone.com/Mv04Oy .
it is to c++ language and i don't know it .Can any one help me to convert and write it to VB ?

the code is :

#include<iostream>
using namespace std;

void Combination(int numInPair[], int indexInPair, int numArray[],int startOfArray, int endOfArray, int maxCount)
{
if(endOfArray == 0 || indexInPair == maxCount) // Termination Condition
{
for(int i = 0; i< maxCount; i++) // Printing Pair's
{ // Number One By
cout << numInPair[i]<<" "; // One
} //
cout<<"\n"; // Next Line
}
else
{
for(int i = startOfArray; i < endOfArray; i++)
{
numInPair[indexInPair] = numArray[i];
Combination(numInPair,indexInPair+1,numArray,i+1,endOfArray,maxCount);
// indexInPair+1 : proceding to next position in pair
// i+1 : excluding element by incrementing start of array.
// So in next call we iterate for new start to end
}

}
}

void Combination(int * intArray,int arrLength, int pairLength)
{
int * arrPair = new int[pairLength];
Combination(arrPair,0,intArray,0,arrLength,pairLength);
delete[] arrPair;
}

int main()
{
int arrOfNumbers[] = {1, 2, 3, 4, 5};
int length = sizeof(arrOfNumbers)/sizeof(arrOfNumbers[0]);
int sizeOfPair = 3;
Combination(arrOfNumbers,length,sizeOfPair);
return 0;
}

Viewing all articles
Browse latest Browse all 21348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>