home *** CD-ROM | disk | FTP | other *** search
- //#include <stdio.h>
- #include <string.h>
- #include <iostream.h>
-
-
- class CITY
- {
- char * Name;
- int Longitude;
- int Latitude;
-
- public:
-
- CITY(char * NewName, int NewLong, int NewLat)
- {
- Name = new char[strlen(NewName) + 1];
- strcpy (Name, NewName);
-
- Longitude = NewLong;
- Latitude = NewLat;
- }
-
- char * GetName(void)
- {
- return Name;
- }
-
- int GetLongitude(void)
- {
- return Longitude;
- }
-
- int GetLatitude(void)
- {
- return Latitude;
- }
- };
-
-
- int main(void)
- {
- CITY Toronto( "Toronto", 79, 44);
-
- // printf("\nThe longitude of %s is %4i", Toronto.GetName(), Toronto.GetLongitude());
- // printf("\nThe latitude of %s is %4i", Toronto.GetName(), Toronto.GetLatitude());
- cout << "\nThe longitude of " << Toronto.GetName() << " is " << Toronto.GetLongitude() << " degrees.";
- cout << "\nThe latitude of " << Toronto.GetName() << " is " << Toronto.GetLatitude() << " degrees.";
-
- return 0;
-
- }
-