It looks like Yahoo is chopping off some of my statements,oh well
// execute.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int printNumber(int *theNumber, int index, int noNumber,int minValue,int maxValue);
#define NO_NUMBERS 5
#define MIN_VALUE 1
#define MAX_VALUE 30
int _tmain(int argc, _TCHAR* argv[])
{
int theNumber[NO_NUMBERS];
int result = printNumber(theNumber,0,NO_NUMBERS,MIN_VALUE,MAX_VALUE);
if(getchar());
return result;
}
int printNumber(int *theNumber, int index, int noNumber,int minValue,int maxValue)
{
int value;
int count;
if((noNumber<1)||(maxValue<=minValue)||(index<0))
return -1;
for(value = minValue;value<=maxValue;value++)
{
theNumber[index] = value;
for( count= index-1;count>=0;count--)
{
if(theNumber[count]==theNumber[index])
break;
}
if(count==-1)
{
if((index+1)
printNumber(theNumber,index+1,noNumber,minValue,maxValue);
else
{
for(count = 0;count
{
printf("%d ",theNumber[count]);
}
printf("\n");
}
}
}
return 0;
}