输入字符串,完成strlen,strcpy,strcat,strcmp函数运算的C++程序
展开全部
#include <string.h>
int main(){
char str[256];
char strTmp[256];
int len = strlen(str);
if(len<200)
{
strcat(str, " --appended");
}
else
{
strcpy(strTmp, str);
}
if(strcmp(str, strTmp)==0)
{
printf("There are same!!");
}
else
{
printf("There are different!!");
}
return 0;
}
int main(){
char str[256];
char strTmp[256];
int len = strlen(str);
if(len<200)
{
strcat(str, " --appended");
}
else
{
strcpy(strTmp, str);
}
if(strcmp(str, strTmp)==0)
{
printf("There are same!!");
}
else
{
printf("There are different!!");
}
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询