有没有c语言大神呀,真的不会做这几道题了,求大神帮帮忙 50
1个回答
2016-11-30
展开全部
这种题还给人要钱?真恶心,我给你写一题。
#include<iostream>
using namespace std;
void find(char*str1, char*str2, char*str3)
{
char*p1 = str1;
char*p2 = str2;
char*p3 = str3;
while (*p1 != '\0'&& *p2 != '\0')
{
if (('0' <= *p1&&*p1 <= '9') || ('a' <= *p1&&*p1 <= 'z') || ('A' <= *p1&&*p1 <= 'Z'))
{
if (('0' <= *p2&&*p2 <= '9') || ('a' <= *p2&&*p2 <= 'z') || ('A' <= *p2 && *p2 <= 'Z'))
{
if (*p1 >= *p2)
*p3 = *p1;
else
*p3 = *p2;
p1++;
p2++;
p3++;
}
else
p2++;
}
else
p1++;
}
}
void main()
{
char str1[] = "45ac1)56113";
char str2[] = "46857a";
char str3[10] = {0};
find(str1, str2, str3);
cout << "str3=" << str3 << endl;
system("pause");
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询