注册 登录
编程论坛 C++教室

为什么在 OJ 上会出现运行错误 求指点!

拯救 发布于 2014-07-02 22:25, 667 次点击
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
    char s1[30],s2[30],s3[30];
    while (cin>>s1>>s2>>s3)
    {
        getchar();
        if (strcmp(s3, strcat(s1, s2))==0)
        {
            printf("%s\n", s3);
        }
        else if (strcmp(s2, strcat(s1, s3))==0)
        {
            printf("%s\n", s2);
        }
        else if (strcmp(s1, strcat(s2, s3))==0)
        {
            printf("%s\n", s1);
        }
        else
        {
            printf("no\n");
        }
    }
    return 0;
}
1 回复
1