Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
谁帮我看看 怎么就CE了#include<iostream> #include<stdlib.h> #include<string.h> using namespace std; int main() { int t,i,j,h,mi,s; char y[10],m[10],d[10],hour[10],min[10],sec[10]; while(1==scanf("%d",&t)){ getchar(); for(i=0;i<t;i++){ cin.getline(y,sizeof(y),'/'); cin.getline(m,sizeof(m),'/'); cin.getline(d,sizeof(d),'-'); cin.getline(hour,sizeof(hour),':'); cin.getline(min,sizeof(min),':'); cin.getline(sec,sizeof(sec)); cout<<m<<'/'<<d<<'/'<<y<<'-'; s=atoi(hour);mi=atoi(min);s=atoi(sec); if(h==0) printf("%d:%s:%sam\n",12,min,sec); else if(h<12) printf("%s:%s:%sam\n",hour,min,sec); else if(h==12&&mi==0&&s==0) printf("%s:%s:%spm\n",hour,min,sec); else if(h==12) printf("%d:%s:%spm\n",12,min,sec); else if(h>12) printf("%s:%s:%spm\n",h-12,min,sec); } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator