结构体
2023-08-27 11:12:33
发布于:北京
17阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
struct abc{
string name;
string password;
string email;
}a[100005];
int main()
{
string u_email;
int n;
cin >> u_email >> n;
for(int i = 1; i <= n; i++)
cin >> a[i].name >> a[i].password >> a[i].email;
bool temp = false; //是否有一致,如果标记为true说明 有输出,否则为false输出空
for(int i = 1; i <= n; i++)
{
if(a[i].email == u_email)//验证邮箱是否相同
{
for(int j = 0; j < a[i].password.length(); j++)
{
if(a[i].password[j] >= 'a' && a[i].password[j] <= 'z')
a[i].password[j] -= 32;
else if(a[i].password[j] >= 'A' && a[i].password[j] <= 'Z')
a[i].password[j] += 32;
}
cout << a[i].name <<" "<< a[i].password << endl;
temp = true;
}
}
if(!temp) cout << "empty" << endl;
}
这里空空如也
有帮助,赞一个