wyp20130701 @ 2024-06-21 18:10:01
#include <bits/stdc++.h>
using namespace std;
char s1[105],s2[105];
void check()
{
int l = strlen(s2);
int num = 0;bool flag1 = false,flag2 = false,flag3 = false,flag4 = false;
for (int i = 0;i < l;i++)
{
if (s2[i] >= '0' && s2[i] <= '9')
{
flag1 = true;
}
if (s2[i] >= 'a' && s2[i] <= 'z')
{
flag2 = true;
}
if (s2[i] >= 'A' && s2[i] <= 'Z')
{
flag3 = true;
}
if (s2[i] == '$' || s2[i] == '#' || s2[i] == '@' || s2[i] == '!')
{
flag4 = true;
}
if ((s2[i] <= '0' || s2[i] >= '9') && (s2[i] <= 'a' || s2[i] >= 'z') && (s2[i] >= 'Z' || s2[i] <= 'A') && (s2[i] != '$' && s2[i] != '#' && s2[i] != '@' && s2[i] != '!'))
{
return ;
}
}
if (l >= 6 && l <= 12)
{
if (flag1)
{
num++;
}
if (flag2)
{
num++;
}
if (flag3)
{
num++;
}
if (flag4)
{
num++;
}
if (num >= 2)
{
cout << s2 << endl;
return;
}
}
}
int main()
{
int i = 0,j = 0;
cin >> s1;
while (s1[j] != '\0')
{
if (s1[j] == ',')
{
check();
s2[0] = '\0';
i = -1;
}
else
{
s2[i] = s1[j];
}
i++;j++;
}
return 0;
}
by wyp20130701 @ 2024-06-21 18:11:36
C++语言,求大佬回复
by Betrayer_of_love @ 2024-06-21 19:18:28
@wyp20130701
你照着这个代码注释理解一下
by wyp20130701 @ 2024-06-21 21:10:52
@SiuuuCR7 谢了,我过了
by Betrayer_of_love @ 2024-06-21 21:18:22
@wyp20130701 不用谢,我的代码也有
by wyp20130701 @ 2024-06-21 21:30:31
@SiuuuCR7 其实我早就发现了
by wyp20130701 @ 2024-06-21 21:31:12
@SiuuuCR7 不过也是要感谢你的
by wyp20130701 @ 2024-06-21 21:32:50
@SiuuuCR7 其实我还没过
by Betrayer_of_love @ 2024-06-21 21:34:08
@wyp20130701 呃,稍等
by Betrayer_of_love @ 2024-06-21 21:34:39
@wyp20130701
#include <bits/stdc++.h>
using namespace std;
int n;
string a1;
char a2;
int i;
bool as(string s){
for(int i=0; i<s.size(); i++){
if(!((s[i]>='0'&&s[i]<='9')||(s[i]>='A'&&s[i]<='Z')||(s[i]>='a'&&s[i]<='z')||s[i]=='!'||s[i]=='@'||s[i]=='#'||s[i]=='$')){
return false;
}
}
return true;
}
bool bs(string x){
int zhong1=0;
int zhong2=0;
int zhong3=0;
int zi=0;
for(int i=0; i<x.size(); i++){
if(x[i]>='0'&&x[i]<='9'){
zhong1=1;
}
else if(x[i]>='A'&&x[i]<='Z'){
zhong2=1;
}
else if(x[i]>='a'&&x[i]<='z'){
zhong3=1;
}
else if(x[i]=='!'||x[i]=='@'||x[i]=='#'||x[i]=='$'){
zi=1;
}
}
if((zhong1+zhong2+zhong3)>=2&&zi){
return true;
}
return false;
}
int main(){
while(cin>>a2){
if(a2!=',') {
a1=a1+a2;
}
else{
if(a1.size()>=6&&a1.size()<=12){
if(as(a1)){
if(bs(a1)){
cout<<a1<<endl;
}
}
}
a1.erase(0);
}
}
return 0;
}
by wyp20130701 @ 2024-06-21 21:44:11
@SiuuuCR7 谢谢你,这次是真过了