上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 17 下一页
摘要: #include <stdio.h>#define MAX 100 //最多种类数int current[MAX];int opt[MAX];int t;double totalV;double totalW;double MaxValue;struct{ double value; double weight;}goods[MAX];void checkout(int i,double tw,int totalValue);void main(){ int i; double value,weight; printf("请输入类别个数"); scanf(&qu 阅读全文
posted @ 2012-11-15 01:31 ﹏Sakura 阅读(189) 评论(0) 推荐(0) 编辑
摘要: javascript 中 object类型的元素是浅拷贝的。也就是说副本指向相同地址<script>var a = b = []; a.push('aaa'); console.dir(b);/*Array[1] 0: "aaa" length: 1 __proto__: Array[0]*/</script>实现深层拷贝<script>function dCopy(o){ if(typeof(o) != 'object') return o; var _o = o.constructor == Array 阅读全文
posted @ 2012-11-10 00:48 ﹏Sakura 阅读(369) 评论(0) 推荐(0) 编辑
摘要: 由于是午休时间写的 所以不太详细尽情谅解。 主要还是老生常谈的问题 OOP 。。。 工作两年 对OOP 这玩意有些自己的理念 ,但翻遍了各大书店的OOP 介绍都是天马行空 (很像是一个人写的) <?php class Car{ public getName(){ return $this->name; } public getSpeed(){ return $this->speed; } }?>这种东西相信只会出现在书上 真正项目基本看不到这类代码。。(JAVAbean除外)而根据这类思路我有了以下代码... 阅读全文
posted @ 2012-10-29 12:37 ﹏Sakura 阅读(4077) 评论(6) 推荐(1) 编辑
摘要: #include <stdio.h>#define MAX 30#define S 3void main(){ int i,j,k,temp,Monkey[MAX]; for(i=0;i<MAX;i++) Monkey[i] = i+1; //为猴子赋值 使其成为一串 for(i=MAX-1;i>=0;i--){ //最后只剩下一只猴子。所以要执行30次 for(k=0;k<S;k++){ //每次把数到S的猴子放到最后一个 下次循环从倒数第二个开始 temp = Mo... 阅读全文
posted @ 2012-10-18 00:46 ﹏Sakura 阅读(560) 评论(0) 推荐(0) 编辑
摘要: <?php// 欄位字串為$querys = array("name"=>"shian"); // 數值等於多少$querys = array("number"=>7); // 數值大於多少$querys = array("number"=>array('$gt' => 5)); // 數值大於等於多少$querys = array("number"=>array('$gte' => 2)); // 數值小於多少$quer 阅读全文
posted @ 2012-10-15 14:28 ﹏Sakura 阅读(3364) 评论(0) 推荐(0) 编辑
摘要: #include<math.h>int checkPrimer(double a){ //验证是否为质数 unsigned long i, asqrt; asqrt = (unsigned long)sqrt(a); for(i =2;i<= asqrt;i++){ if((int)a % i == 0) return 0; } return 1;}int checkTruth(unsigned long a, unsigned long *NumberA , unsigned long *NumberB){ un... 阅读全文
posted @ 2012-10-11 01:25 ﹏Sakura 阅读(460) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>void main(){ int test[] = {1,2,3,4}; int x,y,z; for( x=0;x<4;x++){ for( y=0;y<4;y++){ for( z=0;z<4;z++){ if(test[x] != test[y] && test[x] !=test[z] && test[z] !=test[y]) printf("组成的数为:%d%d%d\n",test[x],test[y],test[z]); ... 阅读全文
posted @ 2012-10-03 19:58 ﹏Sakura 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 在页面的最前页加上date_default_timezone_set(PRC); /*把时间调到北京时间,php5默认为格林威治标准时间*/date ()a: "am"或是"pm" A: "AM"或是"PM" d: 几日,两位数字,若不足则补零;从"01"至"31" D: 星期几,3个英文字母,如:"Fri" F: 月份,英文全名,如:"January" h: 12小时制的小时,从"01"至"12" 阅读全文
posted @ 2012-09-29 12:10 ﹏Sakura 阅读(76641) 评论(0) 推荐(1) 编辑
摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>#define MAX 100void insertSort(char *arr, int total){ int i,j,pos; char temp; for(i=1;i<total;i++){ j = i-1; temp = arr[i]; while(j>=0 && temp < arr[j]){ arr[j+1] = arr[j]; j--; } ... 阅读全文
posted @ 2012-09-26 23:34 ﹏Sakura 阅读(287) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>#define MAX 100void selectSort(char *arr, int total){ int i,j,pos; char temp; for(i=0;i<total-1;i++){ pos = i; //此处需注意每次排序是一定要给pos 赋值 否则当不交换变量时会有BUG temp = arr[pos]; for(j=i+1;j<total;j++){ i... 阅读全文
posted @ 2012-09-26 00:36 ﹏Sakura 阅读(245) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 17 下一页