#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <ctime>
using namespace std;
int main()
{
srand(time(0));
int number;
number = 2;
while(2 == number) {
int random;
random = rand() % 2;
string alpha[3];
alpha[0] = "a";
alpha[1] = "b";
alpha[2] = "c";
string list[3];
int ran;
ran = rand() % 3;
list[0] = "1";
list[1] = "2";
list[2] = "3";
string choose[2];
choose[0] = 'alpha';
choose[1] = 'list';
cout << choose[random];
system("PAUSE");
};
};
My program as seen above runs just fine for me, except for one small yet crippling bug. The random character that comes out of this program is not from either of my list's! It is always either t or h. Why does this happen? Thanks.