Ciao a tutti...mi sono bloccato in una cosa
sto "cercando" di creare un programma che dato un numero di utenti mi deve generare le generalità di ogni utente e attraverso un menu devo scegliere se la password dovra essere impostata manualmente o automatica(utilizzando 3 diversi criteri)
il problema sta che selezionando l'opzione di generazione automatica della password la stampa ignorando i requisiti impostanti.
#include "stdio.h"
#include "stdlib.h"
#include "time.h"
#include "string.h"
#include "ctype.h"
#define UTENTI 1
#define LUNGHEZZA_CARETTERI 25
#define LUNGHEZZA_INDIRIZZO 45
#define LUNGHEZZA_EMAIL 75
#define LUNGHEZZA_DOMINI 7
typedef struct {
	int giorno;
	int mese;
	int anno;
}data;
typedef struct {
	char nome[LUNGHEZZA_CARETTERI+1];
	char cognome[LUNGHEZZA_CARETTERI+1];
	data datanascita;
	char password[8];
	char passwordtemp[8];
}utenti;
//funzioni
void generaAnagrafica(utenti account[]);
void generaPassword_automatica_livello1(utenti account[]);
void generaPassword_automatica_livello2(utenti account[]);
void generaPassword_automatica_livello3(utenti account[]);
void stampaDatiCompleti(utenti accounts[]);
int main(){
	setvbuf(stdout, NULL, _IONBF, 0);
	utenti anagrafica[UTENTI];
	for (int i=0; i<UTENTI; i++){
		generaAnagrafica(anagrafica);
		printf("\n%d° ACCOUNT: \n", i + 1);
		printf(" COGNOME: %s\n", anagrafica[i].cognome);
			printf(" NOME: %s\n", anagrafica[i].nome);
			printf("DATA DI NASCITA: ");
					 if(anagrafica[i].datanascita.giorno < 10){
						 printf("\t0%d\\", anagrafica[i].datanascita.giorno);
						}else
						{
							printf("\t%d\\", anagrafica[i].datanascita.giorno);
						}
					 if(anagrafica[i].datanascita.mese < 10){
					 			 printf("0%d\\", anagrafica[i].datanascita.mese);
					 			}else
					 			{
					 				printf("%d\\", anagrafica[i].datanascita.mese < 10);
					 			}
			printf("%d\n", anagrafica[i].datanascita.anno);
			char scelta[2];
			char sceltaSicurezza[2];
			do{
						printf("1) Generare la password in automatico\n");
						printf("2) Inserire la password manualmente\n");
						printf("Effettui una scelta (1 o 2): ");
						puts("\n*****************************************");
						scanf("%s", scelta);
					}while(strcmp(scelta,"1") && strcmp(scelta,"2"));
			if (strcmp(scelta,"1") == 0) {	//inserimento automatico
				do{
					printf("\nSelezionare il livello di complessita'\n");
					printf("1) Poco sicura\n");
					printf("2) Mediamente sicura\n");
					printf("3) Sicura\n");
					printf("Effettui una scelta: ");
					scanf("%s", sceltaSicurezza);
				}while(strcmp(sceltaSicurezza,"1") && strcmp(sceltaSicurezza,"2") && strcmp(sceltaSicurezza,"3"));
				printf("Password generata: ");
				if(strcmp(sceltaSicurezza,"1") == 0){
					generaPassword_automatica_livello1(anagrafica);
				} else if(strcmp(sceltaSicurezza,"2") == 0){
				//	 generaPassword_automatica_livello2(anagrafica);
				}else if (strcmp(sceltaSicurezza,"3") == 0){
				//	 generaPassword_automatica_livello3(anagrafica);
				}
			} else if (strcmp(scelta,"2") == 0) {	//inserimento a mano
				printf("passwird generata manualmente");
					}
			//generaPassword_automatica_livello1(anagrafica);
				for (int j=0; j<8; j++){
			printf("%c", anagrafica[i].password[j]);
			}
	}
	 // stampaDatiCompleti(anagrafica);
	return 0;
}
void generaAnagrafica(utenti account[]){
int seed = (time(NULL));
	srand(seed);
	// randomizzo nomi, cognomi, indirizzo e email
	char* nomi [] = {"ALESSANDRO", "GIACOMO", "ALESSIO", "ANTONIO", "CARLO", "FABIO", "ALESSANDRA", "GIACOMA", "ALESSIA", "ANTONIA", "CARLA", "FABIA"};
	char* cognomi [] = {"ROSSI", "BIANCHI", "NEGRO", "RIZZI", "CAMPESE", "IODICE", "ROSSIA", "BIANCHIA", "NEGROA", "RIZZIA", "CAMPESEA", "IODICEA"};
	 char* email[] = {"@gmail.com", "@gmail.it", "@hotmail.it", "@hotmail.it", "@aruba.it", "@aruba.com", "@libero.it"};
int i;
	for ( i=0; i<UTENTI; i++){
	// RANDOM NOMI
	int indice_nomi = 0;
	indice_nomi = rand () % UTENTI;
	strcpy(account[i].nome, nomi[indice_nomi]);
	//RANDOM COGNOMI
	int indice_cognomi = 0;
	indice_cognomi = rand () % UTENTI;
	strcpy(account[i].cognome, cognomi[indice_cognomi]);
	account[i].datanascita.anno = rand () % (2019 - 1950) + 1950;
			account[i].datanascita.mese = rand () % (12 - 01) + 01;
				if(account[i].datanascita.mese < 10){
				}
			if (account[i].datanascita.mese==2 && account[i].datanascita.anno%400==0 ||  (account[i].datanascita.anno%4==0 &&!(account[i].datanascita.anno%100==0))){
			account[i].datanascita.giorno = rand () % (29 - 01) + 01;
		}
			else if (account[i].datanascita.mese==2){
				account[i].datanascita.giorno = rand () % (28 - 01) + 01;
			}
			else if (account[i].datanascita.mese==1 || account[i].datanascita.mese==3 || account[i].datanascita.mese==5 || account[i].datanascita.mese==7 || account[i].datanascita.mese==8 || account[i].datanascita.mese==10){
				account[i].datanascita.giorno = rand () % (31 - 01) + 01;
			}
			else {
				account[i].datanascita.giorno = rand () % (30 - 01) + 01;
			}
			int  passwordrequisiti = 0;
	}
}
	void generaPassword_automatica_livello1(utenti account[]){
int  passwordrequisiti;
	int i,j;
	setvbuf(stdout, NULL, _IONBF, 0);
	do {
	for(i=0; i< 2; i++){
		for(j=0; j< 8; j++){
	  		passwordrequisiti = 0;
			do{
		 		account[i].passwordtemp[j] = '!' + rand() % 'z';
		  		if ((account[i].passwordtemp[j] >='!' && account[i].passwordtemp[j]< '&')
				||(account[i].passwordtemp[j] >='?' && account[i].passwordtemp[j]< '@')
				||(account[i].passwordtemp[j] >='0' && account[i].passwordtemp[j]< '9')
				||(account[i].passwordtemp[j] >='a' && account[i].passwordtemp[j]< 'z')
				||(account[i].passwordtemp[j] >='A' && account[i].passwordtemp[j]< 'Z'))
				passwordrequisiti++;
			} while(passwordrequisiti==0);
	//	printf("%c", account[i].passwordtemp[j]);
		} //printf("\n");
	}
	//printf("\n\n");
int caratteri_numerici = 0;
int caratteri_speciali = 0;
int somma_caratteri_numerici_speciali = 0;
	for(i=0; i< 2; i++){
		for(j=0; j< 8; j++){
			if (isdigit(account[i].passwordtemp[j])) {
				caratteri_numerici++;
				somma_caratteri_numerici_speciali++;
			} else if (ispunct(account[i].passwordtemp[j])) {
				caratteri_speciali++;
				somma_caratteri_numerici_speciali++;
				}
			}}
	if (somma_caratteri_numerici_speciali > 5) {
		passwordrequisiti++;
		printf("Rispettano i requisiti :\n");
		for(i=0; i< 2; i++){
			for(j=0; j< 8; j++){
			account[i].password[j] = account[i].passwordtemp[j];
				//printf("%c", account[i].password[j]);
			}
		printf("\n");
		}
	}
	} while(passwordrequisiti==1);
}