#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char letters[]={'a','b','c','d'};
int unique(int i, int n[]);
void shuffle(){
int i, a, n[100];
char temp;
i=strlen(letters[]);
for(a=0;a<i;a++){
x:;
n[a]=random(i-1);
if(a!=0 && unique( a+1, n[] )==0)
goto x;
}
printf("Letters after shuffling: ");
for(a=0;a<i;i++)
printf("%c ", letters[i]);
getch();
}
main(){
int i;
clrscr();
printf("Letters before shuffling: ");
for(i=0;i<strlen(letters[]);i++)
printf("%c ", letters[i]);
printf("\n\n");
getch();
shuffle();
}
int unique(int i, int n[]){
int a, b;
for(a=0; a<i; a++)
for(b=a+1;b<i;i++)
if(n[a]==n[b])
return 0;
return 1;
}
/* all it does is to shuflle the letters but it has errors please help me*/
what errors does it have?
let me rephrase, what kind of errors are you getting?
Last edited on