摘要: import java.io.*; public class trans{ public static void main(String[] args){ try{ File inFile = new File("D:/****/src.txt"); File outFile = new File("D:/****/tar... 阅读全文
posted @ 2016-12-12 23:20 xkfx 阅读(250) 评论(0) 推荐(0)
摘要: import java.time.*; public class MyTest{ public static void main(String[] args){ LocalDate date = LocalDate.now(); int month = date.getMonthValue(); i 阅读全文
posted @ 2016-12-12 22:55 xkfx 阅读(858) 评论(0) 推荐(0)
摘要: 课本第291页第4题 #include void main() { int n, m, i, k; int p_begin; int arr[100]; scanf("%d", &n); for(i = 0; i = n) i = 0; printf("%d ", arr[i++]); } } 课本第291页第11题 ... 阅读全文
posted @ 2016-12-11 14:03 xkfx 阅读(304) 评论(0) 推荐(0)
摘要: 如何理解快速排序? 第一步,想象手中有一副扑克牌。 第二步,按照一定规则抽取一张牌作为基准牌(中间牌) 第三步,从左边开始挑一张比基准牌大的,先挑出来(正常拿牌姿势,像凑对子一样让这张牌露出来一点)保持牌状不变。 第四步,从右边开始挑一张比基准牌小的,同理。 第五步,交换这两张拍,从交换点继续做第三 阅读全文
posted @ 2016-12-11 09:03 xkfx 阅读(201) 评论(0) 推荐(0)
摘要: strcmp 根据s按照字典顺序小于、等于或大于t的结果分别返回 负整数、0或正整数 至于abcdefg与abcdef谁比较大要看'\0'的acsii码 阅读全文
posted @ 2016-12-10 22:44 xkfx 阅读(231) 评论(0) 推荐(0)
摘要: import java.util.*; public class MyTest{ public static void main(String[] args){ Scanner in = new Scanner(System.in); System.out.print("How many numbers do you need to draw? ");... 阅读全文
posted @ 2016-12-09 23:27 xkfx 阅读(432) 评论(0) 推荐(0)
摘要: corejava 上的一段代码 因吹思婷 阅读全文
posted @ 2016-12-09 18:11 xkfx 阅读(340) 评论(0) 推荐(0)
摘要: #define ALLOCSIZE 10000 static char allocbuf[ALLOCSIZE]; static char *allocp = allocbuf; char *alloc(int n) { if(allocbuf + ALLOCSIZE - allocp >= n){ allocp += n; return allocp ... 阅读全文
posted @ 2016-12-09 15:17 xkfx 阅读(380) 评论(0) 推荐(0)
摘要: #include void main() { int strlen(char *); printf("%d\n", strlen("hello, world")); } int strlen(char *s) { int n; for(n = 0; *s != '\0'; s ++) ; return n; } 阅读全文
posted @ 2016-12-09 12:46 xkfx 阅读(203) 评论(0) 推荐(0)
摘要: a[i] 与 *(a+i) 是等价的。 事实上在计算a[i]的值时,c语言首先将前者转换为后者形式, 而且,通常而言,用指针编写的程序要比用数组下标编写的程序执行速度快,(为什么?) 因此,应该尽量用*(a+i)代替a[i], 但是,我们必须记住 指针是一个变量 在c语言中 pa = a 和 pa 阅读全文
posted @ 2016-12-08 12:05 xkfx 阅读(262) 评论(0) 推荐(0)