Created
May 22, 2013 15:21
-
-
Save sprintr/5628440 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| class Distance { | |
| private: | |
| int feet; | |
| double inches; | |
| public: | |
| void getdistance() { | |
| cout << "Enter feet: " << endl; | |
| cin >> feet; | |
| cout << "Enter inches: " << endl; | |
| cin >> inches; | |
| } | |
| void setdistance(int ft, double in) { | |
| feet = ft; | |
| inches = in; | |
| } | |
| void showdistance() { | |
| cout << feet << "\'-" << inches << "\"" << endl; | |
| } | |
| }; | |
| int main() { | |
| Distance dist1, dist2; | |
| dist1.setdistance(11, 6.25); | |
| dist1.showdistance(); | |
| dist2.getdistance(); | |
| dist2.showdistance(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment