this is magic 8 game
#include <stdlib.h>
#include <time.h>
#include <iostream.h>
template <typename T, int N>
char (&array(T(&)[N]))[N]; // Error
int main()
{
const char *messages[] = {
"I'm a little teapot",
"This is a message",
"If you can read this, you're too close",
"Han shot first",
"What are you looking at?"
};
srand ( (unsigned)time ( 0 ) );
for ( int i = 0; i < 10; i++ ) {
[color="#FF0000"] int r = rand() % sizeof array ( messages );[/color]
cout<< messages[r] <<'\n';
}
return 0;
}
the red fonts has an error on it. can u help me ? thank you
*** MOD EDIT: Added code tags. Please

New Topic/Question
Reply




MultiQuote






|