#include <iostream>
#include <string>
#include <time.h>
using namespace std;
int main(){
srand (time( NULL));
const char* words[] = {"Sunday", "Monday", "Tuesday", "Wedensday", "Thursday", "Friday", "Saturday"};
int Randnum = rand() % 6;
cout << words[Randnum] << endl;
}
So basically what I want to do is that instead of having that int Randnum = rand() % 6 ;, I want to have a variable that changes with the array. something like int Randnum rand() % totalwords;. I tried using sizeof(words but that would only work if I know how many bytes each word took. Is there any way you guys can think of that would let me count each word as 1 item so when the array grows the random number range does too?