zoukankan      html  css  js  c++  java
  • 一个整数123456789,从末尾开始依次放入到数组中,遍历出来

    #import <Foundation/Foundation.h>

    #define NSLog(FORMAT, ...) printf("%s ", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String])

    int main(int argc, const char * argv[]) {

        @autoreleasepool {

            NSMutableString *mustr=[[NSMutableString alloc]init];

            

            int i=123456789;

            NSString *stringInt = [NSString stringWithFormat:@"%d",i];

            

            mustr=[NSMutableString stringWithString:stringInt];

            NSMutableArray *arr=[[NSMutableArray alloc]init];

            NSRange rang;

            

          

            for (int j=mustr.length-1; j+1 != nil; j--) {

                

                rang.location=j;

                

                rang.length=1;

                

                NSString *newStr3=[mustr substringWithRange:rang];

                

                //NSLog(@"%@",newStr3);

                

                [arr addObject:newStr3];

            }

            NSLog(@"输出结果为:");

        

            for(NSDictionary *dic in arr){

            

                NSLog(@"%@",dic);

            }

        

        }

        return 0;

    }

  • 相关阅读:
    settTimeout vs setInterval
    JS继承
    JS创建对象
    原型链
    开始学习python的感受
    Problem 29
    Python 查看关键字
    Problem 21
    Problem 34
    Problem 42
  • 原文地址:https://www.cnblogs.com/shaowenlong/p/5116641.html
Copyright © 2011-2022 走看看