I'm trying to make a death predictor that has a random chance for your character to die as your progress. I'm going to make it have multiple chances to die as well as higher chances the older you grow. How do I fix this basic rand function, to make it so int RandomFactor has a 1-20 number and activates randomly to kill you (sorry if this sounds sadistic)?
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <Windows.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main() {
srand(time(NULL));
int RandomFactor;
RandomFactor = rand();
20 % 1;
for (double count = 0; count < 20; count++) {
if (count < 20) {
Sleep(360);
cout << "\n\t\t\tIt's your birthday! You turned: " << count;
}
else
if (RandomFactor == 1) {
cout << "\n\n\n\t\t\tBANG! You're dead!";
}
}
cout << "\n\n\n\t\t\t ";
return 0;
}