I'm trying to generate a 16 digit random card number in a function for a bank account creating sample. I tried the code below, but it didn't work.
void generate_card_number() {
srand(time(0));
long long int cardnumber = 0;
int i, randctrl;
for (i = 0; i < 15; i++) {
do {
randctrl = rand() % 9;
} while (randctrl == 0);
cardnumber += ((10^i) * randd);
}
printf("\nThe Card Number : %lld", cardnumber);
}
Could you help me, please?
Aucun commentaire:
Enregistrer un commentaire