易截截图软件、单文件、免安装、纯绿色、仅160KB

ACM c函数大全

函数名: abs 功  能: 求整数的绝对值
用  法: int abs(int i);
程序例:
#include <stdio.h>
#include <math.h>
int main(void)
{
  int number = -1234;
  printf("number: %d  absolute value: %d\n", number, abs(number));
  return 0;
}
函数名: atof
功  能: 把字符串转换成浮点数
用  法: double atof(const char *nptr);
程序例:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
   float f;
   char *str = "12345.67";
   f = atof(str);
   printf("string = %s float = %f\n", str, f);
   return 0;
}
函数名: atoi
功  能: 把字符串转换成长整型数
用  法: int atoi(const char *nptr);
程序例:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
   int n;
   char *str = "12345.67";
   n = atoi(str);
   printf("string = %s integer = %d\n", str, n);
   return 0;
}
函数名: atol
功  能: 把字符串转换成长整型数
用  法: long atol(const char *nptr);
程序例:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
   long l;
   char *str = "98765432";
   l = atol(lstr);
   printf("string = %s integer = %ld\n", str, l);
   return(0);
}
函数名: bsearch
功  能: 二分法搜索
用  法: void *bsearch(const void *key, const void *base, size_t *nelem,  size_t width, int(*fcmp)(const void *, const *));
程序例:
#include <stdlib.h>
#include <stdio.h>
#define NELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
int numarray[] = {123, 145, 512, 627, 800, 933};
int numeric (const int *p1, const int *p2)
{
   return(*p1 - *p2);
}
int lookup(int key)
{
   int *itemptr;
   /* The cast of (int(*)(const void *,const void*))
      is needed to avoid a type mismatch error at
      compile time */
 &


相关文档:

C/C++面试题


1.求下面函数的返回值(微软)
int func(x)
{
int countx = 0;
while(x)
{
countx
++;
x = x&(x-1);
}
return countx;
}
假定x = 9999。 答案:8
思路:将x转化为2进制,看含有的1的个数。
2. 什么是“引用”?申明和使用“引用”要注意哪些问题?
答:引用就是某个目标变量的&l ......

交换连个对象的值(C/C++?JAVA)

如何交换两个变量的值:
C语言中的传值代码如下:
int change(int x,int y)
{
int temp=x;
x=y;
y=temp;
}
C语言中的传址代码如下:
int change(int *p,int *q)
{
int temp=*p;
*p=*q;
*q=temp;
}
使用C++中的引用类型代码如下:
int change(int &x,int &y)
{
int temp=x;
x=y;
y=temp;
}
JAV ......

浅谈C/C++内存泄漏及其检测工具

  对于一个c/c++程序员来说,内存泄漏是一个常见的也是令人头疼的问题。已经有许多技术被研究出来以应对这个问题,比如Smart Pointer,Garbage Collection等。Smart Pointer技术比较成熟,STL中已经包含支持Smart Pointer的class,但是它的使用似乎并不广泛,而且它也不能解决所有的问题;Garbage Collection技术在Java中 ......

B/S C/S


C/S模式和B/S模式的区别 
。。。。。。。。。。。。。。。。。。。。。。。。。。。
~~什么是B/S模式     
      B/S模式,即浏览器/服务器模式,是一种从传统的二层CS模式发展起来的新的网络结构模式,其本质是三层结构C/S模式。B/S网络结构模式是基于Intr ......

C和C++的点滴积累(1)

                     C和C++的点滴积累(1)
1. mfc 编程中存在着如果出现“内存不足”的对话框,一种情况是在申请内存的时候出现问题,也就是例如:char *pChar = new char[num]; 但此时num 为零或者负 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号