- 博客(99)
- 收藏
- 关注
原创 修改小程序
Employee information management b{ color:#FFFFFF; font-family:"楷体_gb2312";} Name/td>AgeSexCall Home addresssOperation<?php $link = mysql_pconnect("localhost", "roo
2015-12-17 20:00:40
619
原创 一个小小的购物车系统
index.php:<?phpsession_start();?> Shopping Cart <?php switch($_GET[link]) { case "Computer"; include_once("in_1.php"); break; case "H
2015-12-17 16:06:13
956
原创 一个小的动态验证
Picture Verfication<body background="../image/1.jpg" style="font-size:16px; color:#000099;font-family:'宋体'"><table width="166" border="1" align="center" bordercolor="#CCCCCC"bordercolorlight="#F
2015-12-15 15:45:21
548
原创 指针交换两数组最大值
#include#define N 5int *max(int *k, int n){ int *k1, *k2; k2=k; for(k1=k+1;k1<k+n;k1++) { if(*k1>*k2) { k2=k1; } } return k2;}void swap(int *pa, int *pb){ int temp; temp=*pa
2015-12-15 15:35:54
951
原创 使用指针插入元素
#include#define N 10void sort(int *q, int w, int e){ int *p, *o; for(p=q;p<q+w;p++) { if(*p>e) { o=p; break; } } for(p=q+w;p>=o;p--) *p=*(p-1); *o=e;}int main(){ int i; in
2015-12-15 15:34:48
945
原创 if..else 语句应用
Users: password : <?php if($_POST['sub']) { if($_POST['user']=='admin' and $_POST['pwd']='admin') { echo "Current VIP user"; } else { echo "You are a visitors"; } }?>
2015-12-15 09:39:21
499
原创 IF语句应用
Performance evaluation criteria <table border="1" bordercolor="#000099" bordercolorlight="#000099" cellspacing="0"> Please input test performance: <input type="text" size="10" name="text"
2015-12-15 09:38:09
423
原创 foreach()And array() Function
This is a simple birthday reminders:The current date:<?php $a = array("zhangsan"=>"05月30日","lisi"=>"05月28日","wangwu"=>"05月29日"); foreach($a as $key => $value){ if(date("m月d日") == $v
2015-12-14 18:04:59
386
原创 指针实现冒泡排序
#includevoid order(int *p, int n){ int i,j,t; for(i=0;i<n-1;i++) for(j=0;j<n-j-1;j++) { if(*(p+j)>*(p+j+1)) { t=*(p+j); *(p+j)=*(p+j+1); *(p+j+1)=t; } printf("Order after of arr
2015-12-06 14:46:07
1095
原创 指针遍历数组
#includefloat *search(float(*p)[4]){ int i; float *pt; pt=*(p+1); for(i=0;i<4;i++) { if(*(*p+i)<60) { pt=*p; } } return (pt); }int main(){ float score[][4]={{60,75,82,91},{75,8
2015-12-06 14:41:32
822
原创 关于字符编码设置
要使用html5标记,必须先声明DOCTYPE,web浏览器通过判断文件开头有没有这个声明,让解析其和渲染类型切换成对应HTML5的模式。 -->HTML 5 signThis is html 5 grammar需要注意的是两种字符编码方式不要一同使用,(如下什错误示范)<meta charset="UTF-8" htpp-equiv="Content-Type"conten
2015-12-03 08:12:47
398
原创 自定义函数
<?phpecho "";echo "Number Conmand:";echo "";echo ""; define("PI",3.1415926);function Encrypt($str){ return $str=$str+PI;}function Decrypt($str){ return $str=$str-PI;}if($_POST[sub])
2015-11-30 21:10:53
346
原创 使用常量值
<?php define("PI",3.1415); $r=10; echo "circle of radius 10 units of area:".PI*($r*$r);?>
2015-11-30 21:10:15
455
原创 使用可变变量
<?php $str_name="str_name_1"; $str_name_1="I like PHP"; echo $$str_name;?>
2015-11-30 21:09:32
522
原创 数字跟字符串的转换
<?php $a =10; $b ="I is a string value"; $e =$a+$b; $f =$b+$a; echo "automatic type conversions: "; echo '10+I is a string value='.$e.""; echo "force type conversions: "; echo '10+I is a strin
2015-11-30 21:07:15
376
原创 动态输出JS代码
<?php $str=<<<mark alert("welcome into php code world!"); mark; echo $str;?>
2015-11-30 21:06:12
718
原创 区分单引号和双引号
<?php $a = 1; echo"The strings is:$a".""; echo'printf string:$a';?>
2015-11-30 21:05:16
486
原创 用指针函数输出学生成绩
#includefloat *search(float(*p)[4],int n){ float *pt; pt=*(p+n); return (pt);}int main(){ float score[][4]={{1,2,3,4},{2,3,4,5},{3,4,5,6},{4,5,6,7}}; float *p; int k,i; printf("enter the
2015-11-30 20:58:10
2839
原创 寻找相同元素的指针
#includevoid *find(int *pa, int *pb, int an, int bn){ int *paa, *pbb; paa=pa; pbb=pb; while(paa<pa+an&&pbb<pb+bn) { if(*paa<*pbb) { paa++; } else if(*paa>*pbb) { pbb++; } e
2015-11-30 20:57:12
428
原创 使用指针连接两个字符串
#includevoid connect(char *st1, char *st2, char *q){ for(;*st1!='\0';) { *q=*st1; st1++; q++; } for(;*st2!='\0';) { *q=*st2; st2++; q++; } *q='\0';}int main(){ char str1[]
2015-11-28 15:27:22
9146
2
原创 用指针实现逆序列存放数组元素值
#includeint main(){ int a[10]={1,2,3,4,5,6,7,8,9,10}; int *p=a+9; int i=0; for(i=0;i<10;i++) { printf("%d,",*p); p--; } printf("\n"); return 0;}
2015-11-28 15:26:20
1928
原创 用指针数组构造字符串数组
#includeint main(){ char *week[]={"Monday","Tuesday","Wednesday","Thursday","Friday" ,"Saturday","Sunday"}; int i; printf("Please enter a number for week:\n"); scanf("%d",&i); printf("The week
2015-11-28 15:25:24
451
原创 使用指向指针的指针对字符串排序
#include#includevoid sort(char *strings[], int n){ char *temp; int i,j; for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(strcmp(strings[i],strings[j])>0) { temp=strings[i]; strings
2015-11-27 22:13:01
768
原创 使用指针的指针输出字符串
#includeint main(){ char *strings[]={"A","B","C","D","E"}; char **p,i; p=strings; for(i=0;i<5;i++) { printf("%s\n",*(p+i)); } return 0;}
2015-11-27 22:11:32
1010
原创 使用指针查找数列中的最大值和最小值
#includeint max_min(int a[],int n , int *max, int *min){ int *p; *max= *min= *a; for(p=a+1;p if(*p>*max) *max=*p; else if(*p *min=*p; return 0;}in
2015-11-27 22:10:36
7888
2
原创 使用指针输出数组元素
#includeint main(){ int a[10]; int *p,i; printf("\nPlease input ten integer:\n"); for(i=0;i<10;i++) { scanf("%d",&a[i]); } printf("\n"); for(p=&a;p<(a+10);p++) { printf("%d",*p); } p
2015-11-26 18:50:51
1203
原创 指向结构体变量的指针
#includestruct student{ int num; char name[20]; char sex; int age; float score;};int main(){ struct student student1={1000,"zhangsan",'Man',20,89.9}; struct student *p; p=&student1; pr
2015-11-26 18:50:08
437
原创 指针实现整数排序
#includevoid swap(int *p1, int *p2){ int temp; temp=*p1; *p1=*p2; *p2=temp;}void exchange(int *pt1, int *pt2, int *pt3){ if(*pt1<*pt2) { swap(pt1,pt2); } if(*pt1<*pt3) { swap(pt1,p
2015-11-26 18:49:27
679
原创 获取BIOS常规内存容量
#include#includeint main(){ int memsize; memsize=biosmemory(); printf("\nBIOS regular memory size is %dKB",memsize); return 0;}
2015-11-26 18:48:33
938
原创 获取当前日期与时间
#include#includeint main(){ time_t now; time(&now); printf("\n Now is:%s",ctime(&now)); return 0; }
2015-11-22 13:48:40
499
原创 对数组进行升序和降序排序
#include#includeint main(){ int i,comp1(),comp2(); int num[10]={125,-26,53,12,-6,96,46,85,-45,785}; printf("the original arrat is :\n"); for(i=0;i<10;i++) { printf("%10d",num[i]); } qsort(
2015-11-22 13:46:19
6108
原创 字母检测
#include#includeint main(){ char ch, ch1; while(1) { printf("input the character('q' to quit):"); ch=getchar(); ch1=getchar(); if(ch=='q'||ch=='Q') break; if(isalpha(ch))
2015-11-22 13:44:10
538
原创 显示程序运行时间
#include#includeint main(){ time_t start,end; start=time(NULL); sleep(10); end=time(NULL); printf("%f\n",difftime(end,start)); return 0;}
2015-11-22 09:30:16
511
原创 显示当前日期和时间
#includeint main(){ struct date d; struct time t; getdate(&d); gettime(&t); printf("%d%d%d\n",d.da_year,d.da_mon,d.da.day); printf("%d%d%d",t.ti_hour,ti_min,ti_sec); return 0;}
2015-11-22 09:29:18
346
原创 设置DOS系统时间
#include#includeint main(){ struct time sett,now; struct time origint; gettime(&origint); printf("original time is:%d:%d:%d\n",origint.ti_hour, origint.ti_min, origint.ti_sec); sett.ti_
2015-11-20 17:34:52
920
原创 利用biostime()读取并设置BIOS的时钟
#include#includeint main(){ long origin,new; origin=biostime(0,0); printf("\nthe current time is %ld\n",origin); new=biostime(1,500); printf("The new time is %ld",new); return 0;}
2015-11-20 17:31:07
2154
原创 利用strlwr()任意大写字母转小写
#include#include#includeint main(){ char str[20]; printf("Please input string: "); gets(str); strlwr(str); printf(str); printf("\n"); return 0;}
2015-11-20 17:26:51
968
原创 字符串复制到指定空间
从键盘中输入字符串1和字符串2,将字符串内容保存到内存空间中。#include#includeint main(){ char str1[30], str2[30]; char *p1, *p2; printf("Please input string1: "); gets(str1); printf("Please input string2: "); gets(str2)
2015-11-20 17:25:33
409
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人