The output now is HHHHHHHHHHHHHHHHHHHH. What I would like the program to do is randomNum to have a different value each time it goes through the loop. so it would be like AacCEe... And goes on.
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;
int main(){
srand(time(0));
cout << "You'r PW is: \t" << endl;
char abc [] {'A', 'a', 'B' ,'b', 'C', 'c', 'D', 'd', 'E', 'e', 'F', 'f', 'G', 'g', 'H', 'h', 'I', 'i', 'J', 'j', 'K', 'k'};
int randomNum = rand() % 22;
for(int i = 0; i <20; i++){
cout << abc[randomNum];
}
}
Aucun commentaire:
Enregistrer un commentaire