Xcode5与C的连接丢失错误

Xcode5与C的连接丢失错误,c,xcode5,C,Xcode5,当我构建并运行我的代码时,我得到了这个错误 一个意外退出,失去了连接 程序以退出代码结束-一, 有什么想法吗 #include <stdio.h> int main() { int hour; float price, total_price; char first_letter; printf("Type first letter of worker name> "); scanf("%c",&first_letter);

当我构建并运行我的代码时,我得到了这个错误

一个意外退出,失去了连接

程序以退出代码结束-一,

有什么想法吗

#include <stdio.h>

int main()
{
    int hour;
    float price, total_price;
    char first_letter;
    printf("Type first letter of worker name> ");
    scanf("%c",&first_letter);
    printf("Type work hours> ");
    scanf("%d",&hour);
    printf("Type price for per hour> ");
    scanf("%f",&price);
    total_price = hour * price;
    printf("%c worker will get money per hour: %f\n",first_letter,total_price);
    return 0;
}
#包括
int main()
{
整小时;
浮动价格,总价格;
字符首字母;
printf(“键入工人姓名的第一个字母>”;
scanf(“%c”和第一个字母);
printf(“键入工作时间>”);
扫描频率(“%d”,小时(&H);
printf(“每小时打印价格>”;
scanf(“%f”和“价格”);
总价=小时*价格;
printf(“%c工人每小时将得到钱:%f\n”,第一个字母,总价);
返回0;
}

我遇到了完全相同的问题。使用shift+Enter,不使用shift,它是一个返回。

对我在命令行上构建工作有效,因此代码至少是可以的。我知道了问题所在。需要使用本机键盘。没有任何3d部件键盘我们的解决方案对我有效。知道为什么这很重要吗?当我在XCode中运行我的命令行应用程序时,我必须按shift+Return,但当我从终端运行它时,我只需按Enter。此外,当我在macbook pro内置键盘上使用Return键时,它总是能正常工作,但问题只出现在XCode中,而我的外部Apple键盘上有Return键(银色,带有轻薄的白色键)