1035. Password (20)

来源:互联网 发布:不写代码编程 编辑:程序博客网 时间:2024/06/10 13:32

1035. Password (20)

#include<stdio.h>#include<string.h>#include<malloc.h>struct stu{    char name[15];    char password[15];    int note;};int replace(char c[]);int main(){    int n,count=0,i;    scanf("%d",&n);    struct stu *s=(struct stu *)malloc(n*sizeof(struct stu));    for(i=0;i<n;i++)    {        scanf("%s %s",s[i].name,s[i].password);        s[i].note=replace(s[i].password);        if(s[i].note==1)        {            count++;        }    }    if(count)printf("%d\n",count);    for(i=0;i<n;i++)    {        if(s[i].note==1)        {            printf("%s %s\n",s[i].name,s[i].password);        }    }    if(count==0)    {        if(n==1||n==0)printf("There is %d account and no account is modified",n);        else printf("There are %d accounts and no account is modified",n);    }}int replace(char c[]){    int i,note=0;    for(i=0;i<strlen(c);i++)    {        if(c[i]=='1')        {            c[i]='@';note=1;        }        if(c[i]=='0')        {            c[i]='%';note=1;        }        if(c[i]=='l')        {            c[i]='L';note=1;        }        if(c[i]=='O')        {            c[i]='o';note=1;        }    }    return note;}
0 0
原创粉丝点击