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]; }
2 Answers
+ 3
#include <iostream>
using namespace std;
int main(){
srand(time(0));
string ju[2] = {"a","b"};
cout << ju[rand()%2];
}
0
Please clarify, do you want to print either a or b randomly?