Пример #1
0
void checkPassword(char *password, int *returnList)
{
	int passLength = strlen(password);
	int lowers=0;
	int uppers=0;
	int numbers=0;
	int other=0;
	int charClass=0;
	int a;
	for(a=0;a<passLength;a++)
	{
		charClass=checkCharacter(password[a]);
		if (charClass==0){
			lowers++;
		}
		if (charClass==1){
			uppers++;
		}
		if (charClass==2){
			numbers++;
		}
		if (charClass==3){
			other++;
		}
	}
	returnList[0] = passLength;
	returnList[1] = lowers;
	returnList[2] = uppers;
	returnList[3] = numbers;
	returnList[4] = other;
}
Пример #2
0
BstNode* readFile(FILE* f, BstNode* root){
	char c;
	char s[30];
	int A[256], i;
	for(i = 0; i <259; A[i] = 0,++i);
	printf("\nNhap Dduong dan FIle: ");
	gets(s);
	f= fopen(s, "rb");

	printf("\nFile:\n");
	while( (c = fgetc(f)) != EOF){
		printf("%c", c);
			if(checkCharacter(c))
				++A[c];		
	}
	printf("\n");
	fclose(f);
	
	for( i = 0; i< 256 ; ++i){
		if(A[i] > 0){
			root = insert(root, i,A[i]);
			printf("\n%c: %d", i, A[i]);
		}
	}
	return root;
}
Пример #3
0
int parse(char inst[],char lab[][55]){
	
			int status;
			status =1;
			checkCharacter(inst);
			status=checkOpcode(inst,lab);
			printf("%d\n",status);
			return status;
	
}
Пример #4
0
void hangedGame(char* word)
{
    int i;
    int* found;
    int size = strlen(word);
    found = malloc(size * sizeof(int));

    for ( i = 0; i < size; i++)
    {
        found[i] = 0;
    }

    char character = 0;

    int loop = 10;

    while (loop && !checkWin(word, found))
    {
        printf("Il vous reste %d coups a jouer \n", loop);
        printf("Quel est le mot secret ? ");
        showWord(word, found);
        printf("\nProposez une lettre : ");
        character = lireCaractere();
        checkCharacter(word, found, character);
        loop--;
    }

    if(checkWin(word, found))
        {
            printf("\nBravo ! Vous avez gagné en %d coups !", loop);
            printf("\nLe mot secret était bien '%s'", word);
        }
    else
    {
        printf("Perdu ! Le mot secret était : %s", word);
    }
    free(found);
}