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;

    }

  • 相关阅读:
    7.25
    7.24
    7.23
    7.22
    输入语句/条件运算符
    flowLayoutPanel1设置内容随着鼠标滚动而滚动
    dataGridView读取xml文件
    读文本内容 写入文本内容 创建复制文本
    cmd.ExecuteScalar 和配置连接设置
    $.ajax async同步加载
  • 原文地址:https://www.cnblogs.com/shaowenlong/p/5116641.html
Copyright © 2011-2022 走看看