0

Hello, I am trying to make the program randomly generate one of the words that are inside the vector, which is missing

#include <iostream> using namespace std; int main(){ srand(time(0)); string ju[2] = {"a","b"}; ju[2]=rand()%(0,1); cout << ju[2]; }

23rd Apr 2020, 2:14 PM
KeynerZzz
KeynerZzz - avatar
2 ответов
+ 3
#include <iostream> using namespace std; int main(){ srand(time(0)); string ju[2] = {"a","b"}; cout << ju[rand()%2]; }
23rd Apr 2020, 2:18 PM
HonFu
HonFu - avatar
0
Please clarify, do you want to print either a or b randomly?
23rd Apr 2020, 2:18 PM
Prabhakar Rai
Prabhakar Rai - avatar