1

当我在调试区域中键入时,我的 Xcode(4.5 版)只显示第一个数字(或字符) - 如下所示:


2012-09-26 02:45:31.560 nn[731:303] Which numbers do you want to calculate Great Common Divisor? 

 1st=

4

2012-09-26 02:45:36.777 nn[731:303] 2nd=

6

2012-09-26 02:45:39.633 nn[731:303] your number is 45 and 66, and gcd is 3

它有什么问题?

虽然程序运行良好,但当我更改输出选项(所有输出、目标输出)时,我可以看到我的号码。

这是代码。


#import <Foundation/Foundation.h>

int main (int argc, char *argv[]){
@autoreleasepool{
    int n1, n2;
    int numerator, denominator, remainder, gcd;
    numerator = 0;
    denominator = 0;
    remainder = 0;
    gcd = 0;

    NSLog(@"Which numbers do you want to calculate Great Common Divisor? \n 1st=");
    scanf("%i", &n1);
    NSLog(@"2nd=");
    scanf("%i", &n2);

    numerator = n1;
    denominator = n2;

    while (numerator % denominator != 0){
        remainder = numerator % denominator;
        numerator = denominator;
        denominator = remainder;
    }

    gcd = denominator;
    NSLog(@"your number is %i and %i, and gcd is %i", n1, n2, gcd);
}
return 0;
}

注意:这个问题突然出现(我以前能看到我输入的内容)。我检查了我所有的 mac,所有的 xcode 都是这样工作的。它们都只显示数字(或字符)的第一位。

4

2 回答 2

2

我的 iMac 上也发生了同样的事情,而 Xcode 在我的 MacBook 上的调试模式下运行良好。我认为这是设置 Xcode 首选项的问题。不过,我不知道你是否知道,但苹果已经解决了这个问题。您可以找到更多信息:

https://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-Xcode/_index.html

于 2012-10-18T23:42:34.287 回答
1

酷,毫无疑问,您发现了新 Xcode 调试窗口的错误。代码很好,如果您在标准控制台中运行已编译的程序,它会按预期工作。

您应该将错误报告到Apple Bug Reporter网站,如果您不这样做,我会这样做...

于 2012-09-26T06:37:17.380 回答