Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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++ÄÚ´æ·ÖÅä


#include <iostream>
using namespace std;
void main()
{
 char *p,*q;
 p = "abcde";
 q = p + 3;
 *q = 't';
 cout<<p<<endl;
 cout<<q<<endl;
}
Á½ÖÖÓïÑÔ±àÒë¶¼¿ÉÒÔͨ¹ý
µ±Ö´Ðе½
 *q = 't';
ʱ£¬C++³ÌÐò³öÏÖÄÚ´æ·ÃÎÊ´íÎó£¬C³ÌÐò¿ÉÒ ......

¡¾C\C++ÓïÑÔÈëÃÅÆª¡¿ λÔËËã


»Ø¹Ë֮ǰµÄƪ·ù£¬CÓïÑÔµÄÖ÷Ì岿·Ö»ù±¾ÒѾ­½éÉÜÍêÁË¡£Ö®ËùÒÔûÓнéÉÜC++µÄÏà¹ØÌØÐÔÊÇÒòΪÔÚ֮ǰµÄÎÄÕÂÖÐCºÍC++ÔÚÕâЩ·½Ãæ¶¼Óй²ÐÔ£¬ËùÒÔÔÚÃæÏò¶ÔÏó֮ǰ¡£ÎÒÃÇÏȰÑÕâЩ¹²ÐÔ¸ø½éÉÜÍê¡£Ò²¾ÍÊÇ˵ÔÚ½éÉÜÃæÏò¶ÔÏó֮ǰ£¬ËùÓеÄÎÄÕ¶¼ÊÇCC++Öж¼ÄÜʹÓõġ£´ÓÕâµãÉÏÀ´¿´£¬ÏÖÔÚÕý¼«Á¦·Ü¶·ÓÚC++Õ½ÏßÉϵijõѧÕß»¹ÊǺÜÓÐÓô¦µÄ¡£
±¾Æª¼ ......

B/S C/S


C/SģʽºÍB/SģʽµÄÇø±ð 
¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£
¡«¡«Ê²Ã´ÊÇB/Sģʽ     
      B/Sģʽ£¬¼´ä¯ÀÀÆ÷/·þÎñÆ÷ģʽ£¬ÊÇÒ»ÖÖ´Ó´«Í³µÄ¶þ²ãCSģʽ·¢Õ¹ÆðÀ´µÄеÄÍøÂç½á¹¹Ä£Ê½£¬Æä±¾ÖÊÊÇÈý²ã½á¹¹C/Sģʽ¡£B/SÍøÂç½á¹¹Ä£Ê½ÊÇ»ùÓÚIntr ......

c±ê×¼

developerWorks Öйú > Linux > Óà C99 ½øÐпª·ÅÔ´´úÂëµÄ¿ª·¢ÄúµÄ C ´úÂë·ûºÏ±ê×¼Â𣿠ÎĵµÑ¡Ïî ´òÓ¡±¾Ò³ ½«´ËÒ³×÷Ϊµç×ÓÓʼþ·¢ËÍ ¼¶±ð£º ³õ¼¶ Peter Seebach (developerworks@seebs.plethora.net), ×ÔÓÉ×÷¼Ò 2004 Äê 4 Ô 01 ÈÕ C99 ÊÇʲô£¿Ë­ÐèÒªËü£¿Ëü¿ÉÓÃÁËÂð£¿Poter Seebach ÌÖÂÛÁË ISO C ±ê×¼µÄ 1999 ÄêÐÞ¶©°æ ......

c/c++ string


1.±¾ÕÂ˼άµ¼Í¼£º



Example1:
char
*strcpy(char *target, const char *source) {
  char *t = target;

  // Copy the contents of source into target.
 
while(*source) *target++ = *source++;
  // Null-terminate the
target.
  *ta ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ