
源 程 序
huangyiyun
大专学历,爱好编程,对生活乐观向上,为人友善谦和,能与身边的每一位人友好交往。本人自2006年8年毕业工作自今,算算也快5年了。
展开
-
单向动态链表的创建、输入、插入、删除、输出
#include #include /*如以Turbo C作编译工具请删除此句*/#define LEN sizeof(struct student)struct student{ long num; char name[20]; float score; struct student *next;};int n;struct student *crea原创 2008-01-14 10:23:00 · 3839 阅读 · 2 评论 -
用二维数组名作形参、实参,求3行4列矩阵中的最大值(二)
#include int row,col;float max(float array[][4],int n){ int i=0,j=0; float maxvalue=array[0][0]; for(i=0;i<n;i++) for(j=0;j<4;j++) if(maxvalue<array[i][j]) { maxvalue=arra原创 2009-06-28 00:35:00 · 1463 阅读 · 0 评论 -
求1—100以内的素数
//求1—100以内的素数#include #include #define N 101void main(){ void prime(int array[]);//函数声明。声明形参为数组的函数时,形参括号内不能只写形参类型,应把将要定义的数组名也加上。即不可这样声明:void prime(int) int number[N],i,n=0; for(i=1;i<N原创 2009-06-28 21:24:00 · 1046 阅读 · 0 评论 -
//复合语句内定义变量
//复合语句内定义变量#include void main(){ int array[10],i,x,y; for(i=0;i<10;i++) { int new_array[10];//复合语句内定义变量只能在左花括号"{"后的第一行上 scanf("%d",&array[i]); new_array[i]=array[i];//把array[i]的值赋原创 2009-06-28 22:09:00 · 3423 阅读 · 0 评论 -
多文件程序(extern声明、内部函数、外部函数、外部变量、文件包含)
/*--------------------090629-3.c--------------------*/#include #include "enter_string.c" //运行多文件程序时,需要使用include关键字将多个文件包含到本文件中。#include "delete_string.c" //上同。#include "print_string.c" //原创 2009-06-30 00:22:00 · 5424 阅读 · 0 评论 -
用递归法求汉诺塔移盘问题
#include void main(){ void hanoi(int,char,char,char); void move(char,char); unsigned long steps(int); int n; printf("A座上有多少个盘子?(0<=盘子数<=32):");lable:scanf("%d",&n); if(n=33) { p原创 2009-06-27 00:17:00 · 2921 阅读 · 1 评论 -
已知第5个人的年龄,用递归法求第1个人的年龄
#include int f(int n){ int age; if(n==5) age=10;//可改为if(n==1) age=10; else age=f(n+1)+2;//可改为else age=f(n-1)+2; return age;}void main(){ int age; age=f(1); printf("First body原创 2009-06-27 20:36:00 · 3135 阅读 · 0 评论 -
用二维数组名作形参、实参,求3行4列矩阵中的最大值
#include int row,col;//全局变量float max(float array[][4],int n)//用二维数组名作形参{ int i=0,j=0; float maxvalue=array[0][0]; for(i=0;i<n;i++) for(j=0;j<4;j++) if(maxvalue<array[i][j]) {原创 2009-06-28 00:26:00 · 1852 阅读 · 0 评论 -
求一元二次方程a*x*x+b*x+c=0的3个根
求方程a*x*x+b*x+c=0的根, 用三个函数分别求当b*b-4ac大于0、等于0、小于0时的根,并输出结果。#include #include float x1,x2,disc,p,q;greater_than_zero(float a,float b){ x1=(float)((-b+sqrt(disc))/(2*a)); x2=(float)((-b-原创 2009-06-30 22:29:00 · 6419 阅读 · 0 评论 -
对3*3的二维数组进行转置(行列互换)
#include #define N 3void main(){ void convert(int array[][N]); int i,j,array[N][N]; printf("请为数组赋值:"); for(i=0;i<N;i++) for(j=0;j<N;j++) scanf("%d",&array[i][j]); printf("初始数原创 2009-07-01 23:27:00 · 13017 阅读 · 0 评论 -
字符串合并
#include void main(){ void link(char a1[],char a2[],char a[]); char x1[50],x2[50],x[100]; int i; printf("请为字符数组x1赋值:"); gets(x1); printf("请为字符数组x2赋值:"); gets(x2); link(x1,x2,x);原创 2009-07-03 23:09:00 · 1244 阅读 · 0 评论 -
用递归函数逆序输出数组中的10个元素
#include #define N 10void main(){ void fun(int a[],int); int i,a[N]; for(i=0;i<N;i++) a[i]=i; fun(a,N); printf("/n");}void fun(int a[],int i){ if(i>0)//不可去掉if后的花括号。否则,原创 2009-07-03 22:25:00 · 6807 阅读 · 0 评论 -
倒置数组中的元素.由0—>9倒为9—>0
#include void inverse(int array[],int n){ int i,j,temp; i=n--/2; for(j=0;j<i;j++) { temp=array[j]; array[j]=array[n-j]; array[n-j]=temp; }}void main(){ int i,array原创 2009-07-03 23:10:00 · 1131 阅读 · 0 评论 -
PHP变量的定义、可变变量、变量引用、销毁
<br /><?php$long="big_long_variable_name";$$long="PHP"; /* 用存放在变量$long里的字符串作为新变量的变量名,等同于$big_long_variable_name="PHP"; */$short=& $big_long_variable_name; /* 取变量$big_long_variable_name的值赋给变量$short,此时$short的值为"PHP",等同于$short=& $$long; */print "原创 2010-09-19 16:38:00 · 3030 阅读 · 0 评论 -
HTML之Page标记
<br /><html> <head> <Meta http-equiv=Content-Type Content="text/html;charset=gb2312"><!--设置字符集--> <Meta http-equiv=Content-Lauguage Content=zh-CN><!--设置语言--> <!--<Meta http-equiv=Refresh Content=30>本行代码指每30秒钟自动刷新一次--> <Meta http-equiv=Refresh原创 2011-03-26 02:10:00 · 1808 阅读 · 0 评论 -
text style
<br /><h2 align=center>重庆云天下信息技术有限公司简介</h2><p align=left><dd><b>重庆云天下信息技术有限公司</b>(简称“云天下”,English called"CLOBIT")位于重庆市科技先进区渝北区两路,公司成立于2011年4月,是政府财政支持、市级重点行业微企,大学生创业企业。</p><div align=right><b><font color=Teal>Chongqing clobit information technology co.,原创 2011-03-26 22:59:00 · 762 阅读 · 0 评论 -
用递归法求n的阶乘
#include void main(){ float f(int);//函数原型 int n; float sum; printf("你想求谁(整数)的阶乘:"); scanf("%d",&n); sum=f(n); printf("%d!=%.2f/n",n,sum);}float f(int n){原创 2009-06-26 21:29:00 · 22530 阅读 · 0 评论 -
猴子吃桃,C语言,递归法
//猴子吃桃问题。猴子第一天摘下若干个桃子,当即吃了一半,还不过瘾,又多吃了一个。第二天早上又将剩下的桃子吃掉一半,又多吃一个。以后每天早上都吃了前一天剩下的一半零一个。到第10天早上想再吃时,见只剩下一个桃子了。求第一天共摘多少桃子。 //C语言,递归法://首先我们来明确一下题意,由"到第10天早上想再吃时,见只剩下一个桃子了"可知,事实上在第九天吃过后就只有一个了.我们用to原创 2009-06-25 23:47:00 · 15242 阅读 · 3 评论 -
谭浩强著《C程序设计(第二版)》习题13.5
#include #include #include #define FSCANF_FPRINTF#define ALL_KINDS_OF_OUT#define FPUTC 1#define FWRITE 1#define FPRINTF 1#define FPUTS 1main(){ FILE *fpA,*fpB,*fpC; char原创 2009-08-18 23:00:00 · 1510 阅读 · 0 评论 -
结构体成员排序
#include #include struct student{ int num; char name[10]; float score;}a[5];main(){ int i,j,number; char nam[10]; float scor; printf("please input number and name and score:/n")原创 2008-01-18 20:57:00 · 1268 阅读 · 0 评论 -
求二维数组中的最大值及所在位置
#include #include #define M 3#define N 4void main(){ int a[M][N],i,j,x=0,y=0,max; printf("please input %dnumbers:",M*N); i=0; while(i { j=0; while(j { scanf("%d",&a[i][j]); j++; } i++; } pri原创 2008-09-07 16:23:00 · 7671 阅读 · 0 评论 -
对一个3行4列的二维数组按从大到小的顺序排序
#include #include #define M 3#define N 4void main(){ int a[M][N],i,j,x,y,temp; printf("please input %dnumbers:",M*N); for(i=0;i for(j=0;j scanf("%d",&a[i][j]); puts("resource array:"); for(i=0;i {原创 2008-09-07 16:19:00 · 4935 阅读 · 0 评论 -
把a[3][4]转换成b[4][3]
#include #include void main(){ int i,j,a[][4]={{0,1,2,3},{4,5,6,7},{8,9,10,11}},b[4][3]; printf("please input 12 numbers:"); for(i=0;i scanf("%d%d%d%d",&a[i][0],&a[i][1],&a[i][2],&a[i][3]); printf("r原创 2008-09-07 16:22:00 · 968 阅读 · 0 评论 -
定时翻滚的HTML代码
定时滚动代码 LINE-HEIGHT及HEIGHT用于控制每次翻滚所显示的行数aaaaaaaaabbbbbbbbb ccccccccc dddddddddfunction startmarquee(lh,speed,delay,index){var t;var p=false;var o=document.getElementById("marqueebox"+i翻译 2009-02-06 14:01:00 · 1263 阅读 · 0 评论 -
[*注意指向常量的字符指针变量*]用指向常量的字符指针变量和字符数组方法把字符串a复制到字符串b中
#include #include void copy_string(char *from,char *to){ int i=0; while(from[i]!=/0) { to[i]=from[i]; i++; } to[i]=/0;}main(){ char *a="I am a teacher."; char b原创 2009-07-23 17:53:00 · 1839 阅读 · 0 评论 -
可变格式输出函数printf()
#include main(){ char format[]={"a=%d, b=%f/n"};//char format[]="a=%d, b=%f/n"; int a=47; double b=52.47; printf(format,a,b);} #include main(){ char *format; int a=47;原创 2009-07-23 18:46:00 · 986 阅读 · 0 评论 -
返回指针值的函数
#include main(){ float score[][4]={60,70,80,90,56,89,67,88,34,78,90,66}; float *search(float (*pointer)[4],int n); float *p; int i,m; printf("enter the number of student:"); scanf(原创 2009-07-24 16:37:00 · 831 阅读 · 0 评论 -
用指向指针的指针和指针数组输出一个整型数组
#include main(){ static int a[5]={1,3,5,7,9}; int *num[5]={&a[0],&a[1],&a[2],&a[3],&a[4]}; int **p,i; p=num; for(i=0;i<5;i++) { printf("%d ",**p);//p表示num(或者说num+0),*p就等同于*num(或者原创 2009-07-24 17:59:00 · 2668 阅读 · 0 评论 -
用函数+指针数组对输入的3个字符串按由小到大的顺序输出
#include #include main(){ void swap(char *,char *); char *str[3];//指针数组,表示元素str[0]、str[1]、str[2]内存储的为指针(地址)。 char arr1[50],arr2[50],arr3[50]; int i; printf("Input 3 lines:/n"); g原创 2009-07-25 17:46:00 · 9191 阅读 · 1 评论 -
指向函数的指针变量例题
题目:设计一个函数process,在调用它的时候,每次实现不同的功能。在main()函数中输入a和b两个数,第一次调用process时找出a、b中的大者,第二次调用process时找出a、b中的小者,第三次调用process求a、b之和。 #include #include main(){ int max(int,int); int min(int,int);原创 2009-07-24 16:23:00 · 1142 阅读 · 0 评论 -
用递归函数+指向整型数据的指针变量对输入的3个整数按从小到大排序
#include main(){ void swap(int *,int *,int *);//函数原型 int a,b,c; int *p1,*p2,*p3; p1=&a;//不可错写成p1=a,p2=b,p3=c, 因为仅有数组名(包括字符数组/整型数组/指针数组等)才代表地址 p2=&b; p3=&c; printf("Enter 3 intege原创 2009-07-25 12:18:00 · 4040 阅读 · 0 评论 -
谭浩强教授《C程序设计题解与上机指导(第二版)》习题10.15
有一个班,有4名学生、5门课程。(1)求第一门课的平均分;(2)找出有两门以上课程不及格的学生,输出他们的学号和全部课程成绩及平均分;(3)找出平均成绩在90分以上或全部课程成绩在85分以上的学生。#include #include main(){ void avsco(); void avcour(); void fail2(); void good();原创 2009-07-29 22:07:00 · 2320 阅读 · 0 评论 -
VBS中数组的动态改变、赋值、清除
ReDim varArrary(2,3) 2代表列,3代表行Dim strArraryDim lngCol 列Dim lngRow 行↑:上述变量的声明均采用匈牙利命名法strArrary=""For lngRow=0 to 3 For lngCol=0 to 2 If lngCol=0 then varArrary(lngCol,lngR原创 2009-05-25 20:27:00 · 8226 阅读 · 0 评论 -
谭浩强著《C程序设计(第二版)》习题13.6
#include #include #include #define N 5struct students{ long number; char name[15]; float score[3]; float aver; struct student *next;};main(){ FILE *fp; struct stude原创 2009-08-18 23:03:00 · 1832 阅读 · 0 评论 -
TABLE的CSS应用(细线表格)
table {border-collapse:collapse;} table,td,th {border:1px solid red;}“自由”后的自学知识重点:请注意表格内部的单元格合并FirstsecondThirdfourthFifthSixth12345612345原创 2012-12-26 22:17:03 · 5168 阅读 · 1 评论