12 2011 档案

摘要:#include <stdio.h>void print_result(float *,int);void Shell_Sort(float *,int);int main(){ int i; float array[10]; float * pointer; printf("请输入10个数:\n"); for(i=0;i<10;i++) { scanf("%f",&array[i]); } pointer=array; Shell_Sort(pointer,10); print_result(pointer,10); ... 阅读全文
posted @ 2011-12-31 22:20 天行侠 阅读(870) 评论(0) 推荐(0)
摘要:#include <stdio.h>void print_result(float *,int);void Insert_Sort(float *,int);int main(){ int i; float array[10]; float * pointer; printf("请输入10个数:\n"); for(i=0;i<10;i++) { scanf("%f",&array[i]); } pointer=array; Insert_Sort(pointer,10); print_result(pointer,10)... 阅读全文
posted @ 2011-12-31 21:37 天行侠 阅读(1357) 评论(0) 推荐(0)
摘要:#include <stdio.h>void print_result(float *,int);void Select_Sort(float *,int);int main(){ int i; float array[10]; float * pointer; printf("请输入10个数:\n"); for(i=0;i<10;i++) { scanf("%f",&array[i]); } pointer=array; Select_Sort(pointer,10); print_result(pointer,10)... 阅读全文
posted @ 2011-12-31 18:19 天行侠 阅读(2318) 评论(0) 推荐(0)
摘要:以前用数组写过各种排序方法,现在用指针来试下了“冒泡排序法”。代码如下:#include <stdio.h>void print_result(float *,int);void bubble_sort(float *,int);int main(){ int i; float array[10]; float * pointer; printf("请输入10个数:\n"); for(i=0;i<10;i++) { scanf("%f",&array[i]); } pointer=array; bubble_sort(poin. 阅读全文
posted @ 2011-12-31 17:40 天行侠 阅读(13470) 评论(0) 推荐(1)
摘要:在看到麻省理工学院的线性代数公开课的视频时,了解到有几种矩阵相乘的方法:#include <stdio.h>#include <stdlib.h>#include <math.h>#define M 2#define N 3#define P 4/* * A*B=C * (M,N) * (N,P) =(M,P) */float a[M][N] = {{5, 2, 4}, {6, 3, 9}};float b[N][P] = {{7, 8, 9, 10}, {1, 4,... 阅读全文
posted @ 2011-12-29 23:59 天行侠 阅读(12749) 评论(0) 推荐(0)
摘要:高斯若尔当方便解N元方程:#include <stdio.h>#include <stdlib.h>#include <math.h>float a[3][4]={{2,1,-1,8},{-3,-1,2,-11},{-2,1,2,-3}};int rows=3,cols=4;void print_matrix(){//打印矩阵 int i,j; int m=rows,n=cols; for(i=0;i<m;i++) { for(j=0;j<n;j++){ printf("%10.3f\t",a[i][j]); } ... 阅读全文
posted @ 2011-12-26 17:51 天行侠 阅读(3673) 评论(0) 推荐(1)
摘要:C语言#include <stdio.h>char toUpper(char);char toLower(char);int main(){ char c1='A',c2='b'; char s1[]="Hello world!"; int i; printf("原始:c1=%c,c2=%c\n",c1,c2); printf("大写:c1=%c,c2=%c\n",toUpper(c1),toUpper(c2)); printf("小写:c1=%c,c2=%c\n",to 阅读全文
posted @ 2011-12-10 15:52 天行侠 阅读(533) 评论(0) 推荐(0)
摘要:C语言#include <stdio.h>int main(){ char c1,c2,c3; c1=97; c2=98; //ascii码 c3='c'; //字符 char c4[]="d"; //字符串 char c5=c4[0];//从字符串中取出第一个字符。 printf("c1=%c,c2=%c,c3=%c,c4=%s\n",c1,c2,c3,c4); printf("c1=%d,c2=%d,c3=%d,c4=%d\n",c1,c2,c3,c5); return 0;}note:字符型不能直接通 阅读全文
posted @ 2011-12-10 15:15 天行侠 阅读(1406) 评论(0) 推荐(0)
摘要:高中快毕业的时候,计算机老师对我说,QBASIC你学的不错了,可以学习C语言了,于是跑遍了整个县城的书店,才找到一本C语言的教材和几年的电脑爱好者合订本。在暑假里,全靠记忆学习,差不多半个月看完了整本书,虽然没有计算机来实际编程,但是还是很有效(年轻记忆力好),刚上大学的时候就能编写很多小程序,都已经超过大学教科书的范围,比如C语言的鼠标控制以及图形化界面操作。 工作以后几乎没有在用过C语言了,而都在学什么asp,javascript,html,xhtml,xml,xsl,css,VB6,VB2005,后来又学什么C#,php,和各种php框架。最近突然很怀念那时候时候的C语言了,于... 阅读全文
posted @ 2011-12-10 13:41 天行侠 阅读(594) 评论(0) 推荐(0)