代码在Xcode中正确执行,但没有终端

时间:2018-10-10 13:56:47

标签: c xcode terminal

为什么此C代码无法在Terminal中正确执行,但可以在Xcode中正常运行?

int main () {

    int farh, celcius;
    int lower, upper, incr;

    lower = 0;            // The lowest fahrenheit tempeture allowed.
    upper = 300;        // Highest fahrenheit temperature allowed.
    incr = 20;            // The increments in which the fahrenheit increases until it reaches (upper)

    printf("Thanks for using our converter!\n ");

    farh = lower;
    while (farh <= upper) {

        celcius = 5 * (farh - 32) /9;
        printf("%d\t%d\n", farh, celcius);
        farh = farh + incr;
    }

    return 0;
}

输出:

0 个答案:

没有答案