I have a couple of sentences in an array. I need to randomly display 1 of them. How can I do this?
So what would the systax be
char array1[j] = rand () % i;
no it is not like that. you do not set the elements of the array to be a number from 0-5, what you want is just to display the string as you said in your original post cout << array[rand() % 5] << "\n"; Note in the above the value 5 assumes you have 5 strings. Replace that with however many strings you actually have in your array.