ios2048

摘要: 自学一段时间的ios,尝试着做了个2048,因为之前做过Android的2048,所以逻辑等都知道.做起来还算顺利,之前出了一点小bug,都已经改过来了.第一次自己尝试写写东西,没有开发经验,比较乱,不过已经尽力整理过了.源码已经上传.http://download.csdn.net/downloa... 阅读全文
posted @ 2015-11-06 23:14 ll_xyls 阅读(227) 评论(0) 推荐(0) 编辑

插入排序

摘要: #include int *a;int n;void print(){ for (int i = 0; i 0 && a[j-1] > key; j--) { a[j] = a[j-1]; } a[j] = key; }}int mai... 阅读全文
posted @ 2015-11-02 22:08 ll_xyls 阅读(132) 评论(0) 推荐(0) 编辑

OC的类

摘要: #import typedef enum{ kSoldierLevel1, kSoldierLevel2, kSoldierLevel3}SoldierLevel;@interface Gun : NSObject{ @public int _bulletCount;}... 阅读全文
posted @ 2015-10-26 21:17 ll_xyls 阅读(111) 评论(0) 推荐(0) 编辑

static, extern的用法和区别, const用法

摘要: 当使用static来修饰局部变量,那么会延长局部变量的生命周期, 并且会更改局部变量存储的位置 ,将局部变量从栈转移到静态区中.只要使用static修改局部变量之后,当执行到定义局部变量的代码就会分配存储空间, 但是只有程序结束才会释放该存储空间用static声明或定义一个变量,那么变量只分配一次内... 阅读全文
posted @ 2015-10-24 21:15 ll_xyls 阅读(256) 评论(0) 推荐(0) 编辑

数独游戏

摘要: 你一定听说过“数独”游戏。如下图所示,玩家需要根据9×9盘面上的已知数字,推理出所有剩余空格的数字,并满足每一行、每一列、每一个同色九宫内的数字均含1-9,不重复。数独的答案都是唯一的,所以,多个解也称为无解。本图的数字据说是芬兰数学家花了3个月的时间设计出来的较难的题目。但对会使用计算机编程的你来... 阅读全文
posted @ 2015-10-23 21:56 ll_xyls 阅读(381) 评论(0) 推荐(0) 编辑

万年历

摘要: #include int year(int y){ if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0) return 366; else return 365;}int main(int argc, const ... 阅读全文
posted @ 2015-10-22 18:36 ll_xyls 阅读(171) 评论(0) 推荐(0) 编辑

n后问题

摘要: 在n*n的棋盘上放置彼此不受攻击的n个皇后,按照国际象棋的规则,皇后可以攻击与之处在同一行或同一列或同一斜线上的棋子。n后问题等价于在n*n格的棋盘上放置n个皇后,任何2个皇后不放在同一行或同一列或同一斜线上。共有多少中放法?1.回溯法#include #include int *x;int n;i... 阅读全文
posted @ 2015-10-21 23:58 ll_xyls 阅读(163) 评论(0) 推荐(0) 编辑

选择,冒泡排序,折半查找,插入

摘要: #include void selectSort(int nums[], int length);void bubbleSort(int nums[], int length);int findKey(int num[], int len, int k);int insertKey(int num[... 阅读全文
posted @ 2015-10-20 21:40 ll_xyls 阅读(145) 评论(0) 推荐(0) 编辑

迷宫

摘要: #include void print(char cs[6][6]){ for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { printf("%c", cs[i][j]); } ... 阅读全文
posted @ 2015-10-19 20:49 ll_xyls 阅读(125) 评论(0) 推荐(0) 编辑

int型转二进制,八进制,十六进制查表法

摘要: #include void toBinary(int num);void toOct(int num);void toHex(int num);void total(int num, int base, int offset);void toBinary2(int num);void toOct2(... 阅读全文
posted @ 2015-10-19 19:31 ll_xyls 阅读(422) 评论(0) 推荐(0) 编辑