Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. enum status { start, finish } ;
  2.  
  3. class animal {
  4.  
  5. char race_track[70]; //attributes
  6. int pos, status;
  7.  
  8. public:
  9. void start_race() ;
  10. };
  11.  
  12. class tortoise : public animal {
  13.  
  14. public:
  15. void move_tortoise( int *T_pos ) ;
  16. };
  17.  
  18. class hare : public animal {
  19.  
  20. public:
  21. void move_hare( int *H_pos ) ;
  22. };
  23.  
  24. void animal::start_race(){
  25.  
  26. pos = 0;
  27. status = start;
  28. return;
  29. }
  30.  
  31. -----------------------------------------------
  32. /*void print_map( array1[], array2[] ) ;*/
  33.  
  34. int main (){
  35.  
  36. tortoise t ; hare h ;
  37.  
  38. int timer = 0 ; cout << "start.."<< endl ;
  39.  
  40. t.start_race(); h.start_race();
  41.  
  42. while ( ( t.status != finish ) || ( h.status != finish ) ) {
  43.  
  44. t.move_tortoise( &t.pos ) ;
  45. h.move_hare( &h.pos ) ;
  46.  
  47. //print_race( t.race_track, h.race_track ) ;
  48.  
  49. timer++ ;
  50. }
  51. }
  52. ===========================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement