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

C 基础

递归链表反序
void Invert(struct node *p)
{
     if(p->next==NULL) return;
     if(p->next->next!=0)
          Invert(p->next);
    p->next->next = p;
    p->next = 0;
}
两种方法判断是否有相同字串,一是效率最高的,二是最节省内存的.
int fn1(const char *str)
{
 unsigned char *p = ( unsigned char *)str;
 int a[255]={0};
 for( ; *p != '\0'; p++ )
  if( ++a[*p] == 2 ) return 1;
 return 0;
}
int fn2(const char *str)
{
   const char *p1, *p2;
   if (*str == '\0')
      return 0;
   for (p1 = str; *p1 != ''; p1++)
      for (p2 = p1 + 1; *p2 !=''; p2++) 
         if (*p1 == *p2)
            return 1;
   return 0;
}
一句话判断是否是2的幂次: #define Is2n(a)  ( a > 0 ) && ( ( ( ~a + 0x01 ) &a ) == a )
int a[3];
a[0]=0; a[1]=1; a[2]=2;
int *p, *q;
p=a;
q=&a[2];

a[q-p]=?
当然是
2

高低位交换:
int test;
test = ( test<<8 & 0xFF00 ) | ( test>>8 & 0x00FF );

找一个数1的个数:
内存换速度
char one[256]={0,1,1,2,1,2,……} // 此为 0-255 每个数中 1 的个数
int func(int n){
  for(int i=0;n>0;n>>=8)
    i+=one[n&255];
  return i;
}
2)&优化
int func(int n){
  int count=0;
  while(n>0){
    n&=(n-1);
    count++;
  }
  return count;
}


相关文档:

c sharp 命令行的用法

使用 C# 2.0 命令行编译器
http://msdn.microsoft.com/zh-cn/library/ms379563(vs.80).aspx#mainSection
摘要:本文分析了使用 C# 命令行编译器 csc.exe 生成应用程序的过程。同时,还将向读者介绍很多为 C# 2.0 独有的编译器选项,例如,extended/reference 标志和强名称支持。阅读完本文的内容之后,您将能够轻松地在没 ......

B/S+C/B+webservice+ALC

今天突然想到B/S结构里,webform是无法取得客户端的MAC地址和硬件信息的,就突发奇想,用C/S结构,但是因为C/S结构的很多的东西不能动态,就考虑到了C/B结构
最后决定用webservice+ALC+C/B结构 ,搭建我的OA系统
努力ing ......

C程序中main参数argv和argc

      命令行界面的程序,通常都需要输入命令行参数帮助程序执行。main是最典型的此类应用,main的参数之前都被忽略掉了。
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
   int count;
   printf("The command line has %d arguments:\n", ......

c/c++笔试题目(林锐)

本试题仅用于考查C++/C程序员的基本编程技能。内容限于C++/C常用语法,不涉及数据结构、算法以及深奥的语法。考试成绩能反映出考生的编程质量以及对C++/C的理解程度,但不能反映考生的智力和软件开发能力。
笔试时间90分钟。请考生认真答题,切勿轻视。
一、请填写BOOL , float, 指针变量 与“零值”比较的 i ......

C: 面向对象(2)

演示如何用C实现继承,重载之类的玩艺儿。VC++6.0编译通过。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef class
        #define class struct
#endif
#ifndef private
        #define privat ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号