c++ - 从 2 位输入输出 4 位年份
问题描述
这是我正在编写的代码的一部分。
如果 à 用户以 2 位数字输入年份 ( '94 ),则它将年份输出为 4 位数字 { 1994 )
我遇到了需要与我需要相反的问题:将 4 位数年份转换为 2 位数年份
我的部分代码:
#include <iostream>
using namespace std;
int main() {
Int yr;
cout<<"Enter year: " <<endl;
cin>>yr;
cout<<"The year is "<<yr<<endl;
return 0;
}
解决方案
当人们在 1990 年代后期进行 y2k 转换时,这种情况经常出现。
一种常见的实现是选择 1950 作为截止值,因此51
through99
被视为1951
through 1999
,而00
through50
被视为2000
through 2050
。
推荐阅读
- javascript - 以一种优雅的方式结合异步和同步功能
- python - “cdqa”的问题:无法从“joblib._memmapping_reducer”导入名称“TemporaryResourcesManager”
- android - 在 PagingDataAdapter JetPack 分页 Android 中对已加载的数据(PagingData)应用过滤器
- python - keras Transformer 模型 EncoderLayer
- excel - 您是否曾经尝试过使用共享 excel 的 Apache POI?
- python - PYTHONPATH 代替 Lambda 层
- javascript - (node:25372) DeprecationWarning:消息事件已被弃用。改用 messageCreate
- teradata - 当字段值为空字符串 ("") 时,Teradata Fastload 插入 Null
- linux - Sysdig - 如何将两个 .scap 文件合并为一个 .scap 文件?
- python - 将 csv 转换为 json 并用另一个变量包装 json