Hi, i have an array (of chars, if it matters) and i basically want to extract random entries from them for output to the screen, any ideas ?
Any help appreciated.
Hi, i have an array (of chars, if it matters) and i basically want to extract random entries from them for output to the screen, any ideas ?
Any help appreciated.
#include <ctime>
#include <cstdlib>
#include <iostream>
using namespace std;
main()
{
char array[20];
// initialize the array with values you want.
.
.
.
.
srand (time(NULL));
for (i = 1; i <= 5; i++)
cout << array[rand() % 20];
return 0;
}