I'm currently learning C++ and have written a bit of code that selects and plays a random film quote.
The starting point of the code is an array of strings that looks like this:
string filmQuotes[] = { "film1.wav", "film2.wav", "film3.wav" etc etc "film40.wav" };
As all the strings have the pattern film+n.wav I thought there must be a better way of declaring them?
Something like:
int i;
for( i = 1; i < 41; i++ ){
filmQuotes[] = "film"+i+".wav";
}
I know the above is a bit of mixture of languages but hopefully you'll understand what I'm looking to do.
Thanks
std::vector. Also please read aboutstd::to_string.