| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> c/c++ >> C语言库函数 (A类字母) C yu yan ku han shu (A lei zi mu )
 

C语言库函数 (A类字母)

2008-06-01 02:10:48 编辑來源:互联网 繁體版 评论
 
 
本文为【C语言库函数 (A类字母)】的汉字拼音对照版显示拼音
  [ fabiaoriqi2002-1-4 9:28:46 ]

  hanshuming: abort

  gong neng: yichangzhongzhiyigejincheng

  yong fa: void abort(void);

  chengxuli:

  #include <stdio.h>

  #include <stdlib.h>

  int main(void)

  {

  printf("Calling abort()\n");

  abort();

  return 0; /* This is never reached */

  }

  hanshuming: abs

  gong neng: qiuzhengshudejueduizhi

  yong fa: int abs(int i);

  chengxuli:

  #include <stdio.h>

  #include <math.h>

  int main(void)

  {

  int number = -1234;

  printf("number: %d absolute value: %d\n", number, abs(number));

  return 0;

  }

  hanshuming: absread, abswirte

  gong neng: jueduicipanshanquduxieshuju

  yong fa: int absread(int drive, int nsects, int sectno, void *buffer);

  int abswrite(int drive, int nsects, in tsectno, void *buffer);

  chengxuli:

  /* absread example */

  #include <stdio.h>

  #include <conio.h>

  #include <process.h>

  #include <dos.h>

  int main(void)

  {

  int i, strt, ch_out, sector;

  char buf[512];

  printf("Insert a diskette into drive A and press any key\n");

  getch();

  sector = 0;

  if (absread(0, 1, sector, &buf) != 0)

  {

  perror("Disk problem");

  exit(1);

  }

  printf("Read OK\n");

  strt = 3;

  for (i=0; i<80; i++)

  {

  ch_out = buf[strt+i];

  putchar(ch_out);

  }

  printf("\n");

  return(0);

  }

  hanshuming: Access

  gong neng: quedingwenjiande访fangwenquanxian

  yong fa: int access(const char *filename, int amode);

  chengxuli:

  #include <stdio.h>

  #include <io.h>

  int file_exists(char *filename);

  int main(void)

  {

  printf("Does NOTEXIST.FIL exist: %s\n",

  file_exists("NOTEXISTS.FIL") ? "YES" : "NO");

  return 0;

  }

  int file_exists(char *filename)

  {

  return (access(filename, 0) == 0);

  }

  hanshuming: acos

  gong neng: fanyuxianhanshu

  yong fa: double acos(double x);

  chengxuli:

  #include <stdio.h>

  #include <math.h>

  int main(void)

  {

  double result;

  double x = 0.5;

  result = acos(x);

  printf("The arc cosine of %lf is %lf\n", x, result);

  return 0;

  }

  hanshuming: allocmem

  gong neng: fenpeiDOScunchuduan

  yong fa: int allocmem(unsigned size, unsigned *seg);

  chengxuli:

  #include <dos.h>

  #include <alloc.h>

  #include <stdio.h>

  int main(void)

  {

  unsigned int size, segp;

  int stat;

  size = 64; /* (64 x 16) = 1024 bytes */

  stat = allocmem(size, &segp);

  if (stat == -1)

  printf("Allocated memory at segment: %x\n", segp);

  else

  printf("Failed: maximum number of paragraphs available is %u\n",

  stat);

  return 0;

  }

  hanshuming: arc

  gong neng: huayihu线xian

  yong fa: void far arc(int x, int y, int stangle, int endangle, int radius);

  chengxuli:

  #include <graphics.h>

  

   #include <stdlib.h>

  #include <stdio.h>

  #include <conio.h>

  int main(void)

  {

  /* request auto detection */

  int gdriver = DETECT, gmode, errorcode;

  int midx, midy;

  int stangle = 45, endangle = 135;

  int radius = 100;

  /* initialize graphics and local variables */

  initgraph(&gdriver, &gmode, "");

  /* read result of initialization */

  errorcode = graphresult(); /* an error occurred */

  if (errorcode != grOk)

  {

  printf("Graphics error: %s\n", grapherrormsg(errorcode));

  printf("Press any key to halt:");

  getch();

  exit(1); /* terminate with an error code */

  }

  midx = getmaxx() / 2;

  midy = getmaxy() / 2;

  setcolor(getmaxcolor());

  /* draw arc */

  arc(midx, midy, stangle, endangle, radius);

  /* clean up */

  getch();

  closegraph();

  return 0;

  }

  hanshuming: asctime

  gong neng: zhuanhuanriqiheshijianweiASCIIma

  yong fa: char *asctime(const strUCt tm *tblock);

  chengxuli:

  #include <stdio.h>

  #include <string.h>

  #include <time.h>

  int main(void)

  {

  struct tm t;

  char str[80];

  /* sample loading of tm structure */

  t.tm_sec = 1; /* Seconds */

  t.tm_min = 30; /* Minutes */

  t.tm_hour = 9; /* Hour */

  t.tm_mday = 22; /* Day of the Month */

  t.tm_mon = 11; /* Month */

  t.tm_year = 56; /* Year - does not include century */

  t.tm_wday = 4; /* Day of the week */

  t.tm_yday = 0; /* Does not show in asctime */

  t.tm_isdst = 0; /* Is Daylight SavTime; does not show in asctime */

  /* converts structure to null terminated

  string */

  strcpy(str, asctime(&t));

  printf("%s\n", str);

  return 0;

  }

  hanshuming: asin

  gong neng: fanzhengxianhanshu

  yong fa: double asin(double x);

  chengxuli:

  #include <stdio.h>

  #include <math.h>

  int main(void)

  {

  double result;

  double x = 0.5;

  result = asin(x);

  printf("The arc sin of %lf is %lf\n", x, result);

  return(0);

  }

  hanshuming: assert

  gong neng: ceshiyigetiaojianbingkeneng使shichengxuzhongzhi

  yong fa: void assert(int test);

  chengxuli:

  #include <assert.h>

  #include <stdio.h>

  #include <stdlib.h>

  struct ITEM {

  int key;

  int value;

  };

  /* add item to list, make sure list is not null */

  void additem(struct ITEM *itemptr) {

  assert(itemptr != NULL);

  /* add item to list */

  }

  int main(void)

  {

  additem(NULL);

  return 0;

  }

  hanshuming: atan

  gong neng: fanzhengqiehanshu

  yong fa: double atan(double x);

  chengxuli:

  #include <stdio.h>

  #include <math.h>

  int main(void)

  {

  double result;

  double x = 0.5;

  result = atan(x);

  printf("The arc tangent of %lf is %lf\n", x, result);

  return(0);

  }

  hanshuming: atan2

  

   gong neng: jisuanY/Xdefanzhengqiezhi

  yong fa: double atan2(double y, double x);

  chengxuli:

  #include <stdio.h>

  #include <math.h>

  int main(void)

  {

  double result;

  double x = 90.0, y = 45.0;

  result = atan2(y, x);

  printf("The arc tangent ratio of %lf is %lf\n", (y / x), result);

  return 0;

  }

  hanshuming: atexit

  gong neng: zhucezhongzhihanshu

  yong fa: int atexit(atexit_t func);

  chengxuli:

  #include <stdio.h>

  #include <stdlib.h>

  void exit_fn1(void)

  {

  printf("Exit function #1 called\n");

  }

  void exit_fn2(void)

  {

  printf("Exit function #2 called\n");

  }

  int main(void)

  {

  /* post exit function #1 */

  atexit(exit_fn1);

  /* post exit function #2 */

  atexit(exit_fn2);

  return 0;

  }

  hanshuming: atof

  gong neng: bazifuchuanzhuanhuanchengfudianshu

  yong fa: double atof(const char *nptr);

  chengxuli:

  #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;

  }

  hanshuming: atoi

  gong neng: bazifuchuanzhuanhuanchengchangzhengxingshu

  yong fa: int atoi(const char *nptr);

  chengxuli:

  #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;

  }

  hanshuming: atol

  gong neng: bazifuchuanzhuanhuanchengchangzhengxingshu

  yong fa: long atol(const char *nptr);

  chengxuli:

  #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);

  }原文】【拼音
 
 
 
上一篇《透视“语言大战”:C++呼唤敏捷实践》
下一篇《编程指南:C语言编程易犯毛病集合》
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
[ 发表日期:2002-1-4 9:28:46 ] 函数名: abort 功 能: 异常终止一个进程 用 法: void abort(void); 程序例: #include <stdio.h> #include <stdlib.h> int main(void) { printf("Calling abort()\n"); abort(); return 0; /* This is never reached */ } 函数名: 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; } 函数名: absread, abswirte 功 能: 绝对磁盘扇区读、写数据 用 法: int absread(int drive, int nsects, int sectno, void *buffer); int abswrite(int drive, int nsects, in tsectno, void *buffer); 程序例: /* absread example */ #include <stdio.h> #include <conio.h> #include <process.h> #include <dos.h> int main(void) { int i, strt, ch_out, sector; char buf[512]; printf("Insert a diskette into drive A and press any key\n"); getch(); sector = 0; if (absread(0, 1, sector, &buf) != 0) { perror("Disk problem"); exit(1); } printf("Read OK\n"); strt = 3; for (i=0; i<80; i++) { ch_out = buf[strt+i]; putchar(ch_out); } printf("\n"); return(0); } 函数名: Access 功 能: 确定文件的访问权限 用 法: int access(const char *filename, int amode); 程序例: #include <stdio.h> #include <io.h> int file_exists(char *filename); int main(void) { printf("Does NOTEXIST.FIL exist: %s\n", file_exists("NOTEXISTS.FIL") ? "YES" : "NO"); return 0; } int file_exists(char *filename) { return (access(filename, 0) == 0); } 函数名: acos 功 能: 反余弦函数 用 法: double acos(double x); 程序例: #include <stdio.h> #include <math.h> int main(void) { double result; double x = 0.5; result = acos(x); printf("The arc cosine of %lf is %lf\n", x, result); return 0; } 函数名: allocmem 功 能: 分配DOS存储段 用 法: int allocmem(unsigned size, unsigned *seg); 程序例: #include <dos.h> #include <alloc.h> #include <stdio.h> int main(void) { unsigned int size, segp; int stat; size = 64; /* (64 x 16) = 1024 bytes */ stat = allocmem(size, &segp); if (stat == -1) printf("Allocated memory at segment: %x\n", segp); else printf("Failed: maximum number of paragraphs available is %u\n", stat); return 0; } 函数名: arc 功 能: 画一弧线 用 法: void far arc(int x, int y, int stangle, int endangle, int radius); 程序例: #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int midx, midy; int stangle = 45, endangle = 135; int radius = 100; /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); /* an error occurred */ if (errorcode != grOk) { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } midx = getmaxx() / 2; midy = getmaxy() / 2; setcolor(getmaxcolor()); /* draw arc */ arc(midx, midy, stangle, endangle, radius); /* clean up */ getch(); closegraph(); return 0; } 函数名: asctime 功 能: 转换日期和时间为ASCII码 用 法: char *asctime(const strUCt tm *tblock); 程序例: #include <stdio.h> #include <string.h> #include <time.h> int main(void) { struct tm t; char str[80]; /* sample loading of tm structure */ t.tm_sec = 1; /* Seconds */ t.tm_min = 30; /* Minutes */ t.tm_hour = 9; /* Hour */ t.tm_mday = 22; /* Day of the Month */ t.tm_mon = 11; /* Month */ t.tm_year = 56; /* Year - does not include century */ t.tm_wday = 4; /* Day of the week */ t.tm_yday = 0; /* Does not show in asctime */ t.tm_isdst = 0; /* Is Daylight SavTime; does not show in asctime */ /* converts structure to null terminated string */ strcpy(str, asctime(&t)); printf("%s\n", str); return 0; } 函数名: asin 功 能: 反正弦函数 用 法: double asin(double x); 程序例: #include <stdio.h> #include <math.h> int main(void) { double result; double x = 0.5; result = asin(x); printf("The arc sin of %lf is %lf\n", x, result); return(0); } 函数名: assert 功 能: 测试一个条件并可能使程序终止 用 法: void assert(int test); 程序例: #include <assert.h> #include <stdio.h> #include <stdlib.h> struct ITEM { int key; int value; }; /* add item to list, make sure list is not null */ void additem(struct ITEM *itemptr) { assert(itemptr != NULL); /* add item to list */ } int main(void) { additem(NULL); return 0; } 函数名: atan 功 能: 反正切函数 用 法: double atan(double x); 程序例: #include <stdio.h> #include <math.h> int main(void) { double result; double x = 0.5; result = atan(x); printf("The arc tangent of %lf is %lf\n", x, result); return(0); } 函数名: atan2 功 能: 计算Y/X的反正切值 用 法: double atan2(double y, double x); 程序例: #include <stdio.h> #include <math.h> int main(void) { double result; double x = 90.0, y = 45.0; result = atan2(y, x); printf("The arc tangent ratio of %lf is %lf\n", (y / x), result); return 0; } 函数名: atexit 功 能: 注册终止函数 用 法: int atexit(atexit_t func); 程序例: #include <stdio.h> #include <stdlib.h> void exit_fn1(void) { printf("Exit function #1 called\n"); } void exit_fn2(void) { printf("Exit function #2 called\n"); } int main(void) { /* post exit function #1 */ atexit(exit_fn1); /* post exit function #2 */ atexit(exit_fn2); 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); }
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
情人节的清纯女生(9)
情人节的清纯女生(8)
情人节的清纯女生(7)
情人节的清纯女生(6)
山东蓬莱海边组照
一探哲蚌 II
一探哲蚌 III
古长城的一角
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
©2005- 王朝网络 版权所有