//
// 一个人可以吃不同的食物,只要吃东西就会增加体重0.6
//如果出门遛弯,每走100步,体重减0.2,小于100步忽略不计
//
// Created by mac on 15/10/10.
// Copyright © 2015年 mac. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface person:NSObject
{
@public
int weight;
}
-(void)eat;
-(void)wake:(int)num;
@end
@implementation person
-(void)eat
{
NSLog(@"%f",weight+0.6);
}
-(void)wake:(int)num
{
if(num>100)
{
NSLog(@"%f",(weight-num/100)*0.2);
}
}
@end
int main(int argc, const char * argv[]) {
@autoreleasepool
{
person *wangcai=[person new];
[wangcai eat];
[wangcai wake:189];
}
return 0;
} |
|