#include"Clock.h" #include<iostream> using namespace std; int main() { int h, m, s; cin >> h >> m >> s; Clock c1(h, m, s), c2(c1); c1.SetTime(10, 20, 30); c1.getTime(h, m, s); cout << "c1:" << h << ":" << m << ":" << s << endl; c2.ShowTime(); system("pause"); return 0; }#include "Clock.h" #include<iostream> using namespace std; Clock::Clock() { h = m = s = 0; } Clock::~Clock() { } Clock::Clock(int h, int m, int s) { this->h = h; this->m = m; this->s = s; } Clock::Clock(Clock& c) { h = c.h; m = c.m; s = c.s; } void Clock::SetTime(int h, int m, int s) { this->h = h; this->m = m; this->s = s; } void Clock::getTime(int& h, int& m, int& s) { h = this->h; m = this->m; s = this->s; } void Clock::ShowTime() { cout << h << ":" << m << ":
c++简单时钟代码实现
最新推荐文章于 2024-04-24 15:45:50 发布

1939

被折叠的 条评论
为什么被折叠?



