#include <stdio.h>
#include <string.h>
int ol;
int ol2;
int oldf=0;
int oldf2=0;
int ge=0;
int a=0;
int y=0;
int y2=0;
int dda(char e[20])
{
for(int a=0; a<20; a++)
{
if(e[a]==' ')
{
y=a;
}
if(-1<e[a] && e[a]<10)
{
ol=a;
break;
}
}
}
int da(int v, int oo, char ee[20], char ss[20])
{
for(int g=v+1; g<=oo; g++)
{
ee[ge] = ss[g];
ge++;
}
}
int main() {
char str1[20];
char str2[20];
char ex[20];
char ex2[20];
fgets(str1, sizeof(str1), stdin);
fgets(str2, sizeof(str2), stdin);
dda(str1);
int exy = y;
int exol = ol;
dda(str2);
da(exy, exol, ex, str1);
oldf=ge;
ge=0;
da(y, ol, ex2, str2);
oldf2=ge;
int biol;
int biy;
if(exy>y)
{
biy=exy;
}
else{
biy=y;
}
if(exol>ol)
{
biol=exol;
}
else{
biol=ol;
}
if(!strncmp(str1, str2, biol))
{
puts("이름과 나이가 같습니다.");
}
else{
if(!strncmp(str1, str2, biy))
{
puts("이름이 같습니다.");
}
else if(!strncmp(ex, ex2, oldf2))
{
if(!strncmp(ex, ex2, oldf))
{
puts("나이가 같습니다.");
}
}
else{
printf("이름과 나이가 모두 같지 않습니다.");
}
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: