I have a marble.h file, and in the main.cpp file I need to have it call and object( a marble in this case) with a random color (either yellow, red, blue or green) and a random size (small=1, medium=2, or large=3)
then it outputs as as (color,size)
i really have no idea where to start.
the header file already declares int random_color() and in random_size() as well as enum Color (yellow, red,blue,green) and enum Size (small, medium, large)
|
Go4Expert Member
|
|
| 9Sep2010,23:48 | #2 |
|
Well you could do the following
Code:
#include <ctime> //for time
#include <cstdlib> //for srand and rand
int main()
{
std::srand(std::time(0))
Color color = (Color) (rand()%4);
Size size = (Size)( rand()%3);
CreateMyRandomObject(color, size);
}
|
