[C/OC的那点事儿]Objective-C实现学生成绩管理系统

来源:未知 责任编辑:责任编辑 发表时间:2013-12-18 11:33 点击:
[objc]   p>[objc]  

p>//  

p>//  Student.h  

p>//  OC实现学生成绩管理系统  

p>//  

p>//  Created by lichan on 13-11-28.  

p>//  Copyright (c) 2013年 com.lichan. All rights reserved.  

p>//  

p>  

p>#import <Foundation/Foundation.h>  

p>  

p>@interface Student : NSObject<NSCoding>  

p>{  

p>@protected  

p>    int stuID;  

p>    NSString * name;  

p>    int age;  

p>    int score;  

p>      

p>}  

p>  

p>  

p>  

p>@property  int stuID;  

p>@property NSString * name;  

p>@property int age;  

p>@property int score;  

p>  

p>-(id)init;  

p>-(void)inputStudent;  

p>-(void)printStudent;  

p>  

p>//-(void)modifyStudent;  

p>  

p>  

p>  

p>  

p>@end  

p> 

p>Student.m文件

p> 

p>[objc]  

p>//  

p>//  Student.m  

p>//  OC实现学生成绩管理系统  

p>//  

p>//  Created by lichan on 13-11-28.  

p>//  Copyright (c) 2013年 com.lichan. All rights reserved.  

p>//  

p>  

p>#import "Student.h"  

p>  

p>static int staticID = 1;  

p>  

p>@implementation Student  

p>  

p>@synthesize stuID,name,age,score;  

p>  

p>-(id)init  

p>{  

p>    if (self = [super init]) {  

p>        stuID = staticID;  

p>        staticID++;  

p>        name = nil;  

p>        age = 0;  

p>        score = 0;  

p>    }  

p>    else  

p>    {  

p>        self = nil;  

p>    }  

p>    return self;  

p>  

p>}  

p>-(void)inputStudent  

p>{  

p>    NSLog(@"请输入学号为%d的姓名,年龄,成绩(格式ag:lichan 18 100)",stuID);  

p>    char CharName[20];  

p>    int intAge,intScore;  

p>    scanf("%s %d %d",CharName,&intAge,&intScore);  

p>      

p>    [self setName:[[NSString alloc]initWithUTF8String:CharName]];  

p>    [self setAge:intAge];  

p>    [self setScore:intScore];  

p>  

p>      //  NSLog(@"录入完成!");  

p>      

p>  

p>}  

p>-(void)printStudent  
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • cocos2d-x学习笔记(19)--label 、label atlas
  • cocos2d-x学习笔记(23)--地图的使用3--CCTMXLayer
  • Cocos2d-x学习(一):HelloWorld
  • cocos2dx在xcode下开发,编译到android上(2)
  • cocos2d 设置屏幕默认方向
  • cocos2d-x学习笔记(22)--地图的使用2(TMX) --Z-Order、AnchorPoi
  • Cocos2d-x 2.0 之 Actions “三板斧” 之一
  • cocos2d-x学习笔记(18)--游戏打包(windows平台)
  • cocos2d-x学习笔记(16)--spritesheet(精灵表单)
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1