标签:for %s 数字 scanf 大小写 main 位置 min ace
#include<cstdio>
using namespace std;
int main(){
int minum=0;
char week=‘Z‘,hour=‘Z‘;
char arr1[61],arr2[61],arr3[61],arr4[61];
scanf("%s %s %s %s",arr1,arr2,arr3,arr4);
for(int i=0;i<60;i++){
if(arr1[i]==arr2[i])
if(week==‘Z‘&&arr2[i]>=‘A‘&&arr2[i]<=‘G‘) {week=arr1[i];continue;}
if(arr1[i]==arr2[i]&&week!=‘Z‘&&hour==‘Z‘&&((arr1[i]>=‘A‘&&arr1[i]<=‘N‘)||(arr1[i]>=‘0‘&&arr1[i]<=‘9‘))) hour=arr1[i];
}
for(int i=0;i<60;i++){
if(arr4[i]>=‘a‘&&arr4[i]<=‘z‘&&arr3[i]==arr4[i]&&minum==0)
minum=i;
}
char wek[7][4]={{"MON"},{"TUE"},{"WED"},{"THU"},{"FRI"},{"SAT"},{"SUN"}};
printf("%s ",wek[(int)week-‘A‘]);
if(hour>=‘0‘&&hour<=‘9‘)printf("%02d:",(int)hour-‘0‘);
else printf("%02d:",10+hour-‘A‘);
printf("%02d",minum);
return 0;
}
标签:for %s 数字 scanf 大小写 main 位置 min ace
原文地址:https://www.cnblogs.com/hebust/p/9813322.html