i have to make a program that reads m,n from the keyboard.
i have :
the program is going to make commutations of those letters.
if n=2 and m=4 the output will look something like this :
AB,AC,BA,BC ... etc
so it will take the 4 starting letters and make groups of 2.
this is the program that i done so far...
but at the fuction Valid() i am missing something
i didn't manage to figure what. All help is welcomed.
Sorry for the bad english.
in the program i done so far if i put m=4 and n=2 i get : BC CB only .
void Init(int st,int k)
int Am_Succesor(int st,int k)
else return 0;
int Valid(int st,int k)
if(st[k]==st[i]) return 0;
int Solutie(int k)
if(k==n) return 1;
else return 0;
1. Don't double space all your code. It's basically twice as long as it needs to be.
Arrays start at 0, not 1.
3. Don't use global variables.
4. If you absolutely must have global variables, then don't have locals with the same name.
5. Look at Tipar(). Is the newline meant to be part of the for loop? By indentation, it sure looks like it.
1. sorry it happen when i pasted it i have it indented nice in a old Dos IDE
Originally Posted by Salem
2. yes but that fuction is only for printing to the screen even if i do start i=0 the outcome is : AB,AC ....
3. I know is a bad practice but that is how they ask for the project in school
5. The "\n" it's outside of the for just an indentation typo anyway its not included in the for anyway.
The problem is at the Valid() function. It needs more conditions.