📄 pr11011.cpp
字号:
////////////////////////////////////////
// File Name: pr11011.cpp
////////////////////////////////////////
#include <iostream>
////////////////////////////////////////
// The Date class definition.
////////////////////////////////////////
class Date
{
int mo, da, yr;
public:
Date(int m, int d, int y) { mo = m; da = d; yr = y; }
// A member function to return the year.
int getyear() const { return yr; }
// A member function to set the year.
void setyear(int y) { yr = y; }
};
////////////////////////////////////////
// The main() function.
////////////////////////////////////////
int main()
{
// Set up a Date.
Date dt(4, 1, 89);
// Use a member function to read the year value.
std::cout << "The year is: " << dt.getyear() << std::endl;
// Use a member function to change the year.
dt.setyear(97);
std::cout << "The new year is: " << dt.getyear();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -