My Xcode (version 4.5) shows me only the first number (or character) when I type in debug area – like this:
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
What is wrong with it?
Though program works fine, and I can see my number when I once change output options(All Output, Target Output).
Here is the code.
#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;
}
Note: This problem occured suddenly (I used to be able to see what I typed in). I checked out all my macs, and all xcodes work like this. They all show me only the first digit of number (or character).
Cool, you have without any doubt discovered a bug of the new Xcode debug window. The code is fine and if you run the compiled program in a standard console, it works as expected .
You should report the bug into the Apple Bug Reporter site, if you wan’t do it i will do…