📄 pr06031.cpp
字号:
////////////////////////////////////////
// File Name: pr06031.cpp
////////////////////////////////////////
#include <iostream>
// A date structure.
struct Date
{
int month, day, year;
};
// An array of dates.
Date birthdays[] =
{
{12, 17, 37},
{10, 31, 38},
{ 6, 24, 40},
{11, 23, 42},
{ 8, 5, 44},
};
////////////////////////////////////////
// A function to retrieve a date.
////////////////////////////////////////
const Date& getdate(int n)
{
return birthdays[n-1];
}
////////////////////////////////////////
// The main() function.
////////////////////////////////////////
int main()
{
int dt = 99;
while (dt != 0)
{
std::cout << std::endl
<< "Enter date # (1-5, 0 to quit): ";
std::cin >> dt;
if (dt > 0 && dt < 6)
{
const Date& bd = getdate(dt);
std::cout << bd.month << '/'
<< bd.day << '/'
<< bd.year << std::endl;
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -