//28-11-2014 //Engr. Ahmad Furqan Attari //p6.10 #include <iostream> #include <conio.h> using namespace std; class angle { private: int deg; float min; char dir; public: angle() {} angle(int d, float m, char di) : deg(d), min(m), dir(di) {} void get(void) { cout << "Enter degree: "; cin >> deg; cout << "Enter minute: "; cin >> min; cout << "Enter direction(E,W,S,N): "; cin >> dir; } void show(void) { cout << deg << "\xF8" << min << "' " << dir; } }; class ship { private: angle lati, longi; int serial; static int count; public: ship() { count++; serial = count; } void get(void) { cout << "Enter ship"<<serial<<"'s latitude:" << endl; lati.get(); cout << "Enter ship"<<serial<<"'s longitude:" << endl; longi.get(); } void show(void) { cout << "Ship number: " << serial << endl; cout << "Ship position: " << endl; cout << "latitude: "; lati.show(); cout << endl << "longitude: "; longi.show(); cout << endl; } }; int ship::count = 0; void main(void) { ship s1, s2, s3; s1.get(); s2.get(); s3.get(); s1.show(); s2.show(); s3.show(); _getch(); }
Friday, 28 November 2014
Chapter 6,Problem 10:Object Oriented Programming by Robert Lafore in C++ Solution Manual
Subscribe to:
Post Comments (Atom)
very helpful can i get others chapters solutions manuals????
ReplyDelete