Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //My drunk class
- class Drunk
- {
- public:
- //constructor
- //PRE: valid, initilized turf is passed
- //POST: creates a drunk, obviously
- Drunk( Home_Turf&, string, float, coord );
- friend ostream& operator<<( ostream& lhs, Drunk& rhs );
- private:
- string name;
- Home_Turf turf;
- float bac;
- coord location;
- };
- //My constructor
- Drunk::Drunk( Home_Turf& a_turf, string a_name, float a_bac, coord a_location )
- {
- turf = a_turf;
- name = a_name;
- bac = a_bac;
- location = a_location;
- //put us at the starting location (hax)
- turf.world[ location.x ][ location.y ] = BARNEY;
- }
- //My main
- int main()
- {
- srand( time( NULL ) );
- Home_Turf world1;
- Home_Turf world2( 5, 7, 4, 3 );
- coord loc1, loc2;
- loc1.x = loc1.y = loc2.x = loc2.y = 0;
- Drunk driver( world1, "Driver", 0.08f, loc1 );
- Drunk driver2( world2, "Driver2", 0.08f, loc2 );
- cout << world1;
- cout << world2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement