相关分类: Java技术 C/C++ VB delphi
  • c语言实现去除字符串首尾空格

    字符串内存图如下: 引入头文件: 1 #includestdlib.h 2 #includestdio.h 3 #includestring.h 函数原型: 1 void trim(char *strIn /*in*/, char *strOut /*in*/); 实现方法一: void trim(char *strIn, char * strOut){ int i, j ; i = 0 ; j = strlen(strIn) - 1 ; while...

    2018-06-18 04:11:27

  • 数组实现多项式的加减乘运算

    "fatal.h"//头文件 1 #includestdio.h 2 #includestdlib.h 3 #define Error(Str) FatalError(Str) 4 #define FatalError(Str) fprintf(stderr,"%s\n",Str),exit(1); 1 /* This code doesn't really do much */ 2 /* Thus I haven't bothered testing it */ 3 4 #includ...

    2018-06-18 04:11:49

  • 无表头单链表的总结----动态建立链表

    1 #include " head.h " 2 struct Student * creat() 3 { 4 struct Student *head, *p1, *p2; // 先开辟三个结构体指针,*head,(作为返回的头指针) 5 p1 = p2 =( struct Student *) malloc (LEN); 6 scanf_s( " %s %f " , p1-num, N, p1-score); // 先读取输入的信息...

    2018-06-18 04:11:45

  • [APUE]文件和目录(上)

    一、文件权限 1. 各种ID 我在读这一章时遇到了各种ID,根据名字完全不清楚什么意思,幸好看到了这篇文章,http://blog.csdn.net/ccjjnn19890720/article/details/6990656,总结一下 每一个进程其实对应了6个以上的ID,它们分别是:实际用户ID、实际组ID( 我们实际上是...

    2018-06-18 04:11:26

  • C语言实现2个大数相加。

    #includestdio.h #includestring.h int main() { char s1[100],s2[100]; int num1[31],num2[31],len1,len2,i,j; memset(num1,0,sizeof(num1)); memset(num2,0,sizeof(num2)); printf("please int fist number\n"); scanf("%s",s1); printf("please int secound number\...

    2018-06-18 04:11:33

  • 链表_初步认识

    根据代码来分析链表的操作 eg: 1.定义一个结构体,并定义一个表头指针 1 typedef struct NAME{ 2 char * name; 3 struct NAME * pre; 4 struct NAME * next; 5 }T_Name, * PT_Name; 6 7 static PT_Name g_ptNameHead; 2.编写main函数 1 int main( int argc, char ** a...

    2018-06-18 04:11:25

  • C语言计算2个数的最小公倍数

    #includestdio.h int main() { int a,b,i=1,temp,lcm; scanf("%d %d",a,b); if(ab) { temp=a; a=b; b=temp; } lcm=b; if(b%a!=0) { while(lcm%a!=0) { lcm=b*i; i++; } printf("%d",lcm); } else printf("%d",b); }...

    2018-06-18 04:11:20

  • kd树和knn算法的c语言实现

    基于kd树的knn的实现原理可以参考文末的链接,都是一些好文章。 这里参考了别人的代码。用c语言写的包括kd树的构建与查找k近邻的程序。 code: 1 #includestdio.h 2 #includestdlib.h 3 #includemath.h 4 #includetime.h 5 6 typedef struct { // 数据维度 7 double x;...

    2018-06-18 04:11:22

  • [算法]——快速排序(Quick Sort)

    顾名思义,快速排序(quick sort)速度十分快,时间复杂度为O(nlogn)。虽然从此角度讲,也有很多排序算法如归并排序、堆排序甚至希尔排序等,都能达到如此快速,但是快速排序使用更加广泛,以至于STL中默认排序方法就是快速排序。此外,快速排序的思想——划分(Partit...

    2018-06-18 04:11:21

  • c语言实现log日志的写入

    模拟log日志的写入。 调用write_log(pFile, format, ...);方法,即可写入日志,默认在行首加入时间显示。 代码如下:log.c #include stdio.h #include stdarg.h #include time.h int write_log (FILE* pFile, const char * format, ...) { va_list arg; int done; va_s...

    2018-06-18 04:11:17

2