object c基本数据类型使用

#import <Foundation/Foundation.h>
#include "stdio.h"
int main(int argc, const char * argv[])
{

    @autoreleasepool {
        
        // insert code here...
        
        enum week {
            Mon, Tue, Wed, Thu, Fri, Sat, Sun
        };
        
        int days,aweek;
        //aweek = 0;
        
        NSLog(@"Enter week number : ");
        
        scanf("%i", &aweek);
        
        switch (aweek) {
            case Mon:
                break;
            case Tue:
                break;
            case Wed:
                break;
            case Thu:
                break;
            case Fri:
                break;
            case Sat:
                days = 5;
                break;
            case Sun:
                days = 6;
                break;
            default:
                NSLog(@"bad week number");
                days = -1;             
        }
//注意:NSLog打印输出字符串都需要加上小老鼠@,使用NSLog好处可以打印显示当前时间 printf(
"Number of days is %i \n", days); if (days !=0) { NSLog(@"Number of days is %i", days); } } return 0; }

打印控制太输出效果:
2013-12-12 22:55:44.934 test[845:303] Enter week number :
5
Number of days is 5
2013-12-12 22:55:46.674 test[845:303] Number of days is 5


 

posted on 2013-12-12 22:56  阳光总在风雨后001  阅读(129)  评论(0编辑  收藏  举报

导航