• 需要注意的就是把判定函数提取出来,这样可以简化代码,同时参数引用了&,可以对于传入参数进行修改。

    参考代码:
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cstring>
#include<cstdlib> struct node
{
char name[20], password[20];
bool ischange;//如果ischange==true表示password已经修改
}T[1005]; //函数用来判断t的password的是否需要修改,若需要则cnt加1
void crypt(node& t, int& cnt)
{
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)
{
cnt++;
}
} int main()
{
int n, cnt = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%s %s", T[i].name, T[i].password);
T[i].ischange = false;
} for (int i = 0; i < n; i++)
{
crypt(T[i], cnt);
}
if (cnt == 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);
}
}
else
{
printf("%d\n", cnt);
for (int i = 0; i < n; i++)
{
if (T[i].ischange == true)
{
printf("%s %s\n", T[i].name, T[i].password);
}
}
} system("pause");
return 0;
}

PATA1035Password的更多相关文章

随机推荐

  1. nth-of-type(n)和nth-child(n)的区别

    nth-of-type 与nth-child都属于css选择器,都是在同级别节点中找到第n个元素,前者是先确定元素类型,再计算n的位置:后者是先确定n的位置,再确定元素类型 例: <div cl ...

  2. crushmap磁盘智能分组

    目录 简介 配置crush class 1. 创建ssd class 2. 创建基于ssd的class rule 3. 创建基于ssd_rule规则的存储池 4. 测试基于ssd的池 简介 ceph从 ...

  3. Elasticsearch Field Options Norms

    Elasticsearch 定义字段时Norms选项的作用 本文介绍ElasticSearch中2种字段(text 和 keyword)的Norms参数作用. 创建ES索引时,一般指定2种配置信息:s ...

  4. appium+python 多设备并行执行脚本【转】

    1.ready.py文件 def getport(): aport = random.randint(4700, 4900) # 判断端口是否被占用 while getDeviceInfo.is_op ...

  5. 【UOJ#33】【UR #2】树上GCD(长链剖分,分块)

    [UOJ#33][UR #2]树上GCD(长链剖分,分块) 题面 UOJ 题解 首先不求恰好,改为求\(i\)的倍数的个数,最后容斥一下就可以解决了. 那么我们考虑枚举一个\(LCA\)位置,在其两棵 ...

  6. Vue-员工管理系统

    大二暑假进行了两周Vue的入门学习,主要内容就是关于前端的入门学习,在两周内学习了Vue的一些简单使用 主要就是使用数据的双向绑定,使用Vue进行数据处理,使用Bootstrap进行布局搭建,下面是我 ...

  7. oracle 10 升级补丁

    Ooacle 10g补丁安装方法 Windows 平台 方法: 1.  备份数据库:关闭数据库,拷贝,安装软件目录,数据文件拷到另一个地方 2.  关闭停止所有oracle 服务+Distribute ...

  8. [Silverlight 4] 參數的傳遞方法

    Silverlight都會有一個專案叫 *.Web,有個ManagePage.aspx裝戴Silverlight元件,也是應用程式的入口 然後還會有一個專案(此處叫ManageBack),會編譯成Si ...

  9. C# vb .NET识别读取QR二维码

    二维码比条形码具有更多优势,有些场合使用二维码比较多,比如支付.那么如何在C#,.Net平台代码里读取二维码呢?答案是使用SharpBarcode! SharpBarcode是C#快速高效.准确的条形 ...

  10. 给定制的vuejs组件添加v-model双向绑定支持

    用过vuejs的前端工程师,对于v-model一定印象深刻.它向类似textarea,input等原生html原生添加双向数据绑定的能力非常方便.但是对于你的定制vue组件并不是能够直接应用v-mod ...