标签:nts cstring printf str sch isa %s use char
#include<cstdio>
#include<cstring>
struct user{
char id[20];
char password[20];
bool ischange;
}List[1001];
//1 (one) by @, 0 (zero) by %, l by L, and O by o
bool isalter(user &t, int &count){
int len = strlen(t.password);
for(int i = 0; i < len; i++){
if(t.password[i] == '1'){
t.password[i] = '@';
t.ischange = true;
}else if(t.password[i] == '0'){
t.password[i] = '%';
t.ischange = true;
}else if(t.password[i] == 'l'){
t.password[i] = 'L';
t.ischange = true;
}else if(t.password[i] == 'O'){
t.password[i] = 'o';
t.ischange = true;
}
}
if(t.ischange == true)
count++;
}
int main(){
int N, count = 0;
scanf("%d", &N);
for(int i = 0; i < N; i++){
scanf("%s%s", List[i].id, List[i].password);
List[i].ischange = false;
}
for(int j = 0; j < N; j++)
isalter(List[j], count);
if(count == 0){
if(N == 1) printf("There is %d account and no account is modified",N);
else printf("There are %d accounts and no account is modified",N - count);
}else{
printf("%d\n", count);
for(int i = 0; i < N; i++)
if(List[i].ischange == true)
printf("%s %s\n",List[i].id, List[i].password);
}
return 0;
}
标签:nts cstring printf str sch isa %s use char
原文地址:https://www.cnblogs.com/zjsaipplp/p/10425260.html