#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
@autoreleasepool {
NSDate *today = [[NSDate alloc]init];
NSDateFormatter *fmt = [[NSDateFormatter alloc]init];
[fmt setDateFormat:@"yyyy年MM月dd日"];
NSLog(@"%@", [fmt stringFromDate:today]);
int i1 = -1000;
NSLog(@"整数:%d", i1);
double d1 = 1.111;
NSLog(@"少数2桁:%.2f", d1);
char c1 = 'a';
NSLog(@"cのchar:%c", c1);
char *s = "abcde";
NSLog(@"文字列:%s", s);
}
return 0;
}
2012-02-01 21:56:39.021 Study[246:707] 2012年02月01日
2012-02-01 21:56:39.022 Study[246:707] 整数:-1000
2012-02-01 21:56:39.026 Study[246:707] 少数2桁:1.11
2012-02-01 21:56:39.027 Study[246:707] cのchar:a
2012-02-01 21:56:39.028 Study[246:707] 文字列:abcde
Program ended with exit code: 0
String Format