/*4.设计一个成绩类 
1> 属性 
* C语言成绩 
* OC成绩 
* iOS成绩 
 
2> 行为 
* 比较C语言成绩:跟另外一个成绩对象比较C语言成绩,返回成绩差(自己 - 其他成绩) 
* 比较OC成绩:跟另外一个成绩对象比较OC语言成绩,返回成绩差(自己 - 其他成绩) 
* 比较iOS成绩:跟另外一个成绩对象比较iOS语言成绩,返回成绩差(自己 - 其他成绩) 
* 计算总分:算出3科成绩的总分 
* 计算平均分:算出3科成绩的平均分 
 
5.利用前面的成绩类,重新设计一个学生类 
1> 属性 
* 姓名 
* 学号 
* 成绩(包括3科成绩) 
 
2> 行为 
* 比较C语言成绩:跟另外一个学生比较C语言成绩,返回成绩差(自己的成绩 - 其他人的成绩) 
* 比较OC成绩:跟另外一个学生比较OC语言成绩,返回成绩差(自己的成绩 - 其他人的成绩) 
* 比较iOS成绩:跟另外一个学生比较iOS语言成绩,返回成绩差(自己的成绩 - 其他人的成绩) 
* 比较总分:跟另外一个学生比较总分,返回成绩差(自己的成绩 - 其他人的成绩) 
* 比较平均分:跟另外一个学生比较平均分,返回成绩差(自己的成绩 - 其他人的成绩) 
*/ 
 
#import<Foundation/Foundation.h> 
 
//成绩类的设计 
@interface Score :NSObject 
{ 
    @public 
    int cScore;//C语言分数 
    int ocScore;//OC分数 
    int iosScore;//IOS分数 
} 
- (int)compareCScoreWithOther:(Score *)other;//与其他C语言分数比较,返回差值 
- (int)compareOCScoreWithOther:(Score *)other;//与其他OC成绩比较,返回差值 
- (int)compareIOSScoreWithOther:(Score *)other;//与其他IOS成绩比较,返回差值 
- (int)totalScore;//求总分数 
- (int)averageScore;//求3门成绩平均分 
@end 
 
@implementation Score 
- (int)compareCScoreWithOther:(Score *)other 
{ 
    return cScore-other->cScore; 
} 
- (int)compareOCScoreWithOther:(Score *)other 
{ 
    return ocScore-other->ocScore; 
} 
- (int)compareIOSScoreWithOther:(Score *)other 
{ 
    return iosScore-other->iosScore; 
} 
- (int)totalScore 
{ 
    return cScore+ocScore+iosScore; 
} 
- (int)averageScore 
{ 
    return (cScore+ocScore+iosScore)/3; 
} 
 
@end 
 
//学生类的设计 
 
@interface Student :NSObject 
{ 
    @public 
    char *name;//姓名 
    int studentNumber;//学号 
    Score *score;//分数 
} 
- (int)compareCScoreWith:(Student *)other;//和其他同学比较C语言分数 
/*- (int)compareOCScoreWith:(Student *)otherStudent;//和其他同学比较OC分数 
- (int)compareIOSScoreWith:(Student *)otherStudent;//和其他同学比较IOS分数 
- (int)compareTotalScore:(Student *)otherStudent;//和其他同学比较总分 
- (int)compareAverageScore:(Student *)otherStudent;//和其他同学比较平均数*/ 
@end 
 
@implementation Student 
- (int)compareCScoreWith:(Student *)otherstudent//比较C成绩 
{ 
    return [score compareCScoreWith:otherstudent->score]; 
} 
/*- (int)compareOCScoreWith:(Student *)otherStudent 
{ 
 
} 
- (int)compareIOSScoreWith:(Student *)otherStudent 
{ 
 
} 
- (int)compareTotalScore:(Student *)otherStudent 
{ 
 
} 
- (int)compareAverageScore:(Student *)otherStudent 
{ 
 
}*/ 
@end 
 
int main() 
{ 
 
    return 0; 
} 
 
 
 
请大神帮我看一看这句代码- (int)compareCScoreWith:(Student *)otherstudent//比较C成绩 
{ 
    return [score compareCScoreWith:otherstudent->score]; 
} 
什么地方不对?谢谢啦!!! 
 |   
        
 
    
    
    
     
 
 |