Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum status { start, finish } ;
- class animal {
- char race_track[70]; //attributes
- int pos, status;
- public:
- void start_race() ;
- };
- class tortoise : public animal {
- public:
- void move_tortoise( int *T_pos ) ;
- };
- class hare : public animal {
- public:
- void move_hare( int *H_pos ) ;
- };
- void animal::start_race(){
- pos = 0;
- status = start;
- return;
- }
- -----------------------------------------------
- /*void print_map( array1[], array2[] ) ;*/
- int main (){
- tortoise t ; hare h ;
- int timer = 0 ; cout << "start.."<< endl ;
- t.start_race(); h.start_race();
- while ( ( t.status != finish ) || ( h.status != finish ) ) {
- t.move_tortoise( &t.pos ) ;
- h.move_hare( &h.pos ) ;
- //print_race( t.race_track, h.race_track ) ;
- timer++ ;
- }
- }
- ===========================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement