練習用です。いろんなものがごちゃまぜです。
(empty log message)
| @@ -1,15 +1,26 @@ | ||
| 1 | 1 | #include <iostream> |
| 2 | 2 | using namespace std; |
| 3 | 3 | |
| 4 | +class feettoinches{ | |
| 5 | + int feet; | |
| 6 | + int inches; | |
| 7 | +public: | |
| 8 | + feettoinches(int feet); | |
| 9 | +}; | |
| 10 | + | |
| 11 | +feettoinches::feettoinches(int feet) | |
| 12 | +{ | |
| 13 | + this->feet = feet; | |
| 14 | + inches = feet * 12; | |
| 15 | + cout << feet << "フィート" << "は" << inches << "インチです。"; | |
| 16 | +} | |
| 17 | + | |
| 4 | 18 | int main() |
| 5 | 19 | { |
| 6 | 20 | int feet; |
| 7 | - int inches; | |
| 8 | - | |
| 9 | 21 | cout << "何フィートかを入力:"; |
| 10 | 22 | cin >> feet; |
| 11 | - inches = feet * 12; | |
| 12 | - cout << feet << "フィート" << "は" << inches << "インチです。"; | |
| 23 | + feettoinches cnv(feet); | |
| 13 | 24 | |
| 14 | 25 | return 0; |
| 15 | 26 | } |
| \ No newline at end of file |