#include <iostream>using namespace std;class Time{public: int hour; int minute; int sec;};int main(){ Time t1; cin >> t1.hour; cin >> t1.minute; cin >> t1.sec; cout << t1.hour << ":" << t1.minute << ":" << t1.sec; return 0;}將上述C++程序改寫(xiě)為:1:將數(shù)據(jù)成員改為私有的2:將輸入和輸出的功能改為由成員函數(shù)實(shí)現(xiàn)3:在類(lèi)體內(nèi)定義成員函數(shù)謝謝了!
- 3 回答
- 0 關(guān)注
- 1932 瀏覽
添加回答
舉報(bào)
0/150
提交
取消