int main (int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int integerVar = 100;
float floatingVar = 331.79;
double doubleVar = 8.44e+11;
char charVar = ‘ W ’ ;
long int numberOfPoints = 131071100L; // "%li"
// of type long int is formed by optionally appending the letter L (in
upper or lower case) onto the end of an integer constant.
long long int maxAllowedStorage; // “ %lli ”upper or lower case) onto the end of an integer constant.
long double US_deficit_2004 =1.234e+7L; //
// So %Lf would display a long dou-ble value in floating-point notation, %Le would display the same value in scientific nota-
tion, and %Lg would tell NSLog to choose between %Lf and %Le .
short int shintvalue ; // %hi , %ho , or %hx
unsigned int counter = 20000UL;
NSLog (@ ” integerVar = %i ” , integerVar);
NSLog (@ ” floatingVar = %f ” , floatingVar);
NSLog (@ ” doubleVar = %e ” , doubleVar);
NSLog (@ ” doubleVar = %g ” , doubleVar);
NSLog (@ ” charVar = %c ” , charVar);
[pool drain];
return 0;
}
integerVar = 100
floatingVar = 331.790009
doubleVar = 8.440000e+11
doubleVar = 8.44e+11
charVar = ' W '
沒有留言:
張貼留言