编写一个C语言的程序,用于接收用户输入的居住城市

来源:百度知道 编辑:UC知道 时间:2024/09/21 22:57:07
编写一个C语言的程序,用于接收用户输入的居住城市,并在城市的值为“New York”时显示消息"您来自纽约,我也是",否则就显示“我们居住在不同的城市”

楼主的题目是不是上机题目阿 现在的学生真越来越不像话了
天天就知道玩
string city;
bool b=true;
while(b)
{
printf("请输入你所居住的城市:");
scanf("%d",&city)
if(city=="New York")
{
printf("\n您来自纽约,我也是!");

}
else
{
printf("\n我们居住在不同的城市!");
}
string countiue;
printf("\n是否要继续?(Y/N):");
scanf("%d",&countiue);
if(countiue=="Y")
{
b=true;
}
else if(countiue=="N")
{
b=false;
}

}

楼上的写程序
if(city=="New York")
能这样比较???
scanf("%d",&city)
这个语句什么意思