Re: [問題] c語言程式求助
快速上升中 前十名目指 obj-c
因應觀眾要求,換個更obj-C的板本
#import <Foundation/Foundation.h>
@interface person:NSObject
{
double weight;
}
@property double weight;
-(double)pound;
@end
@implementation person
@synthesize weight;
-(double)pound{
return weight/0.454;
}
@end
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Enter your weight(kg)");
double weight=0;
scanf("%d",&weight);
person * I = [[person alloc] init];
[I setWeight:weight];
NSLog(@"Your weight is %d pound",[I pound]);
[pool drain];
return 0;
}
--
◤ ◥ ◢ ◣
傑米,炸掉它吧。 ⊙▁⊙─ ─⊙▂⊙ 碰到問題,用C4就對了!
╰ ∕皿﹨ ◥皿◤ ╯
◥█◤◢ ◥ ︶◤
Adam Savage ◤ ︶ ◥◤ ﹨▼∕◥ Jamie Hyneman
MYTHBUSTERS ◥ ◤\◥ by dajidali
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.244.225
→
10/14 16:29, , 1F
10/14 16:29, 1F
推
10/14 16:38, , 2F
10/14 16:38, 2F
推
10/14 16:43, , 3F
10/14 16:43, 3F
→
10/14 16:44, , 4F
10/14 16:44, 4F
→
10/14 16:44, , 5F
10/14 16:44, 5F
→
10/14 16:44, , 6F
10/14 16:44, 6F
※ 編輯: johnlinvc 來自: 140.112.244.225 (10/14 17:34)
討論串 (同標題文章)