1 #include<cstdio> 2 #include<cstring> 3 struct user{ 4 char id[20]; 5 char password[20]; 6 bool ischange; 7 }List[1001]; 8 bool isalter(user &t, int &count){//1 (one) by @, 0 (zero) by %, l by L, and O by o 9 int len = strlen(t.password); 10 for(int i = 0; i < len; i++){ 11 if(t.password[i] == ‘1‘){ 12 t.password[i] = ‘@‘; 13 t.ischange = true; 14 }else if(t.password[i] == ‘0‘){ 15 t.password[i] = ‘%‘; 16 t.ischange = true; 17 }else if(t.password[i] == ‘l‘){ 18 t.password[i] = ‘L‘; 19 t.ischange = true; 20 }else if(t.password[i] == ‘O‘){ 21 t.password[i] = ‘o‘; 22 t.ischange = true; 23 } 24 } 25 if(t.ischange == true) 26 count++; 27 } 28 int main(){ 29 int N, count = 0; 30 scanf("%d", &N); 31 for(int i = 0; i < N; i++){ 32 scanf("%s%s", List[i].id, List[i].password); 33 List[i].ischange = false; 34 } 35 for(int j = 0; j < N; j++) 36 isalter(List[j], count); 37 if(count == 0){ 38 if(N == 1) printf("There is %d account and no account is modified",N); 39 else printf("There are %d accounts and no account is modified",N-count); 40 }else{ 41 printf("%d\n", count); 42 for(int i = 0; i < N; i++) 43 if(List[i].ischange == true) 44 printf("%s %s\n",List[i].id,List[i].password); 45 } 46 return 0; 47 }
原文地址:https://www.cnblogs.com/zjsaipplp/p/10415834.html
时间: 2024-10-29 21:38:41