Xcode5与C丢失连接错误

时间:2013-12-19 16:29:11

标签: c xcode5

当我建立&运行我的代码我得到这个错误

  

一个退出意外丢失连接

     

程序以退出代码结束; -1

任何想法?

#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;
}

1 个答案:

答案 0 :(得分:1)

我遇到了完全相同的问题。使用shift + Enter,没有移位就是Return。