标签:char code letter last let std amp can git
1 ///水题 2 #include<bits/stdc++.h> 3 using namespace std; 4 int main() 5 { 6 int n; 7 while(~scanf("%d",&n)) 8 { 9 char s[110]; 10 while(n--) 11 { 12 scanf("%s",s); 13 int len=strlen(s); 14 int flag[3]={0}; 15 for(int i=0;i<len;i++) 16 { 17 if(s[i]>=‘a‘&&s[i]<=‘z‘||s[i]>=‘A‘&&s[i]<=‘Z‘) 18 flag[0]++; 19 if(s[i]>=‘0‘&&s[i]<=‘9‘) 20 flag[1]++; 21 if(s[i]==‘@‘||s[i]==‘?‘||s[i]==‘!‘) 22 flag[2]++; 23 } 24 if(flag[0]<4) 25 printf("The last character must be a letter.\n"); 26 else if(flag[1]<4) 27 printf("The last character must be a digit.\n"); 28 else if(flag[2]<2) 29 printf("The last character must be a symbol.\n"); 30 else 31 printf("The last character can be any type.\n"); 32 } 33 } 34 }
标签:char code letter last let std amp can git
原文地址:http://www.cnblogs.com/kearon/p/7214820.html