1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
int getDelay()
{
int delay = 0;
char buffer[255];
do
{
cout << "Enter delay <Between 1 and 10>: ";
cin.getline(buffer,sizeof(buffer));
//Convert the data here:
delay = atoi(buffer);
}while ((delay < 1) || (delay > 10));
return (delay);
}
void getTitle(char title[], int max_len)
{
cout << "Enter title for show: ";
cin.getline(title, max_len);
}
int getNumberOfFlags()
{
int no_of_flags = 0;
char buffer[255];
do
{
cout << "Enter number of flags to display: ";
cin.getline(buffer,sizeof(buffer));
//Convert the data here:
no_of_flags = atoi(buffer);
}while ((no_of_flags < 3) || (no_of_flags > 50));
return (no_of_flags);
}
void setRandomFlagIndexes(int flagIndexes[], int no_of_flags)
{
int i = 0;
//Prompt for array data
for (i = 0; i < no_of_flags; i++)
{
flagIndexes[i] = rand() % 223 + 0; //make random numbers between 0 and 223
}
}
void displayFlags(char title[], char flagFiles[][50], char captions[][50], int flagIndexes[], int no_of_flags, int delay)
{
int i = 0;
for (i = 0; i < no_of_flags; i++)
{
displayBMP(flagFiles[i],200,150);
gout << setPos(200, 50) << title << endg;
gout << setPos(200, 100) << "Flag #" << i+1 << " of " << no_of_flags << " Possible Flags" << endg;
gout << setPos(200, 380) << "press Up Arrow to View Answer for Flag #" << i+1 << endg;
do
{
if (up() )
{
gout << setPos(200,380) << captions[i] << endg;
break;
}
}while (true);
Sleep(delay*1000);
//Remove if caption present
clearGraphics();
}
}
|