从 2 位输入输出 4 位数字年份

Output 4 digit year from 2 digit input

本文关键字:数字 输入输出      更新时间:2023-10-16

这是我正在编写的代码的一部分。

如果 à 用户输入年份为 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年作为截止点,因此5199被视为195119990050被视为20002050