从 2 位输入输出 4 位数字年份
Output 4 digit year from 2 digit input
这是我正在编写的代码的一部分。
如果 à 用户输入年份为 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
到99
被视为1951
到1999
,00
到50
被视为2000
到2050
。
相关文章:
- 从C++中的数字输入动态创建矩阵
- 字符的输入/输出操作
- C++ 中文件输入输出中的长长 v/s int
- 要求用户输入C++输出文件名
- 在C++中重载输入/输出运算符
- 从用户获取输入/输出
- 为什么这个程序接受整数和字母数字输入并打印它们? C++ 中的 std::string 也采用整数值吗?
- 未来值公式显示疯狂巨大数字的输出
- 如何选择waveIn/waveOut函数C++使用的输入/输出设备
- 我没有得到一个数字作为输出,而是一个表情符号
- 非数字输入检查
- 如何在函数中输入数字以输出单词?
- C++击球平均值程序使用输入/输出文件打印名称,平均值,最高/最低平均值时遇到麻烦
- 从 2 位输入输出 4 位数字年份
- 标准输入输出操作如何C++完成
- Windows 中应用程序的每秒输入/输出操作数
- 如何初始化可以设置为默认数组并将输入/输出作为数组的类函数?
- C++ 将数字输入数组并输出
- C++文件输入/输出输出数字而不是字符
- 我需要让一个数字输入的用户输出单个数字使用c++