The alpha way.
Code:
#ifndef _MAIN_CPP_
#define _MAIN_CPP_
// C++ Includes
#include <iostream>
// C Includes
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using std::cout;
using std::endl;
char* Fruit(void); // returns a string
int main(int argc, char **argv)
{
cout << "Today you'll be eating " << Fruit() << endl;
return( cin.get() ? EXIT_SUCCESS:EXIT_FAILURE);
}
char* Fruit(void)
{
srand( (int)time(0) );
char* lpFruit;
int result=1 + (rand() % 5);
if(result== 1) { lpFruit= "Apples"; }
else if(result== 2) { lpFruit= "Grapes"; }
else if(result== 3) { lpFruit= "Banana"; }
else if(result== 4) { lpFruit= "Peach"; }
else if(result== 5) { lpFruit= "Urine"; }
return(lpFruit);
}
#endif