Submission
Status:
PPPPP
Subtask/Task Score:
100/100
Score: 100
User: Phupa
Problemset: คำนำหน้าชื่อ
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-12 11:34:17
#include <bits/stdc++.h>
using namespace std;
int main()
{
char name[50];
int gender,old,marry;
fgets(name,sizeof(name),stdin);
cin>>gender>>old>>marry;
if (gender == 1)
{
if (old<15)
{
cout<<"Master "<<name;
}
else if(old>=15)
{
cout<<"Mr. "<<name;
}
else
{
cout<<"error";
return 0;
}
}
else if (gender == 0)
{
if (old<15)
{
cout<<"Miss "<<name;
}
else if(old>=15)
{
if (marry==0)
{
cout<<"Miss "<<name;
}
else if(marry==1)
{
cout<<"Mrs. "<<name;
}
else
{
cout<<"error";
return 0;
}
}
else
{
cout<<"error";
return 0;
}
}
else
{
cout<<"error";
return 0;
}
return 0;
}