• 输入月份,显示天数C++

    #include <iostream> using namespace std; int main() { int month; do { cout<<"Enter a number of month:"<<endl; cin>>month; if(month<=0||month>12) { cout<<"please check it again!"<<endl; } }while(month<=0||month>12) switch(month) { case 2: cout<<"28 or 29 days"<<endl; break; case 4: case 6: case 9: case 11: cout<<"30 days"<<endl; break; default: cout<<"31 days"<<endl; break; } }

    0
    644
    670B
    2011-04-20
    50
  • 输入一个正整数,判断是不是素数(C++)

    输入一个正整数,判断是不是素数(C++) 设和和我一样的初学者看。

    0
    9724
    594B
    2011-04-19
    50
  • 显示系统时间(C++)

    #include <iostream> #include <ctime> using namespace std; int main() { int x,h,m,s; x=time(NULL); h=(x/3600%24+8)%24; //中国时区加8,由于+8可能导致大于24所以后面又加了%24 m=x%3600/60; s=x%3600%60; cout<<"The current time is:"<<h<<":"<<m<<":"<<s<<endl; return 0; }

    0
    317
    318B
    2011-04-19
    21
  • 阅读者勋章

    授予在CSDN APP累计阅读博文达到3天的你,是你的坚持与努力,使你超越了昨天的自己。
关注 私信
上传资源赚积分or赚钱