time.cpp

来自「1. 请检查下面的程序」· C++ 代码 · 共 35 行

CPP
35
字号
// Time.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
using namespace std;
class Time
{public:
     void set_time();
     void show_time();
private:
	 int hour;
     int minute;
     int second;
};

int main()
{
     Time t;
     t.set_time();
     t.show_time();
	 return 0;
}

void Time::set_time()
{
	 cin >> hour;
     cin >> minute;
     cin >> second;
}
void Time::show_time()
{
     cout << hour << ":" << minute << ":" << second << endl;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?