题解 | 出生日期输入输出

出生日期输入输出

https://www.nowcoder.com/practice/4a4a9dd1edb6453ba4a0432319200743

#include <iostream>
#include <string>
using namespace std;

int main() {
    string s;
    cin >> s;
    string year = s.substr(0,4);
    string month = s.substr(4,2);
    string date = s.substr(6,2);
    cout << "year=" << year << endl;
    cout << "month=" << month << endl;
    cout << "date=" << date <<endl;
    return 0;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

HR岗的
投递菜鸟集团等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务