so I wanna make a mini-quiz in c++ and it doesn't work, here is a code that i've tried
static const char alphanum[] =
"which one of this cities located in france"
cout << "1. paris 2. singapore 3. dubai 4. thailand";
"which one of this countries located in asia"
cout << "1. thailand 2. germany 3. spain 4. italy";
int stringLength = sizeof(alphanum) - 1;
char genRandom() // Random string generator function. {
return alphanum[rand() % stringLength];
}
int main()
{
srand(time(0));
for(int z=0; z < 1; z++)
{
cout << genRandom();
}
example:
which one of this countries located in asia
- thailand 2. germany 3. spain 4. italy
Aucun commentaire:
Enregistrer un commentaire