题解 | #出生日期输入输出# 垃圾题解但是编过了,哈哈哈

出生日期输入输出

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

#include <iostream>

using namespace std;

int main()
{
    int num;
    int year;
    int month;
    int day;
    cin>>num;
    int zero = 0;
    day = num%100;
    month = num/100;
    month = month%100;
    year = num/10000;

    cout<<"year="<<year<<endl;
    if(month >= 1 && month <= 9)
    {
       cout<<"month="<<0<<month<<endl; 
    }
    else if(month > 9)
        cout<<"month="<<month<<endl; 
    if(day >= 1 && day <= 9)
        cout<<"date="<<0<<day<<endl;
    else if(day > 9)
    {
        cout<<"date="<<day<<endl;
    }
return 0;
}
全部评论

相关推荐

今天 18:35
湖南大学 C++
投递拼多多集团-PDD等公司10个岗位
点赞 评论 收藏
分享
夕颜不需要停机维护:xd能把idea都写上去那说明是真没得写了
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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