a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 56|回复: 0

[C语言] C语言函数大全(a开头)3

[复制链接]
发表于 2012-7-31 21:48:08 | 显示全部楼层 |阅读模式
  函数名: asctime% K# o  x' i4 t
  功 能: 转换日期和时间为ASCII码; D1 ~. T; w5 o" a: L8 {" N
  用 法: char *asctime(const struct tm *tblock);
2 s5 C! Z# G6 R) I  程序例:* L# b) J5 Y' d: r: n' w1 Q# T6 \
  #include
  G' z% u+ {  p  #include- v# `  m6 {6 y7 \0 d" V; Z3 `0 E
  #include: r  D  v! {% m8 R
  int main(void)
) P+ ~9 U5 @. N9 V2 s/ J  {5 X, K* I" X0 V% o$ f
  struct tm t;
8 o5 V- Z! W. T' m  char str[80];" Q; T+ S5 Q2 G1 T2 K% f# }$ I
  /* sample loading of tm structure */
+ l" J- I6 n+ d* K  a! l) s7 a0 c  t.tm_sec = 1; /* Seconds */1 v7 n/ C# m, C
  t.tm_min = 30; /* Minutes */1 L$ I/ g. i7 o5 V8 b
  t.tm_hour = 9; /* Hour */
- v) v& A& _, b  t.tm_mday = 22; /* Day of the Month */
+ j4 h" n6 N  e) ?6 G& U$ a  t.tm_mon = 11; /* Month */8 B  Q1 p( E6 U- x- O; _+ }$ V
  t.tm_year = 56; /* Year - does not include century */; S0 R4 V2 i! r5 F1 V* S
  t.tm_wday = 4; /* Day of the week */; _; L" H' [! h6 |$ I7 i
  t.tm_yday = 0; /* Does not show in asctime */- o2 v& A3 h. P3 L* {& k
  t.tm_isdst = 0; /* Is Daylight SavTime; does not show in asctime */
5 B' g6 m! ?$ ?7 o$ q  /* converts structure to null terminated: _( g: @; @; v: ]3 ?0 f
  string */
' a$ G8 k) }& k3 ?8 ^/ R  strcpy(str, asctime(&t));/ a) ]" I$ i8 O" C6 E
  printf("%s\n", str);" j1 |( G& i: Q/ L4 `) \; w8 G5 n: ]
  return 0;( f3 `% W" D5 |1 L9 a& H3 ?
  }
" N1 c4 @% Q3 x0 s' s6 I9 J6 \  函数名: asin
' b/ _4 t; {2 H% A: I2 J4 w& T  功 能: 反正弦函数
* z! M, V9 K% T$ H- [9 ?2 j2 ?  用 法: double asin(double x);) Y, E+ ^4 ^, e  ~$ |1 H0 e
  程序例:
6 `  L1 J; _& A; s2 d, t  #include: l4 @6 G' R  ]3 h1 g! E- J9 u4 U
  #include8 W6 ~3 v1 W8 L. o6 ^; J8 K
  int main(void)
* J& ^- o7 B* }' q1 @  {
) }# k  o, Q+ X- c. m  double result;
1 ~+ O: f# A& J4 Z. N" }* ?% D  double x = 0.5;' |6 E  g% l7 [- E8 H) R- J
  result = asin(x);8 U, m6 x0 S$ l$ Y9 m/ ]% I
  printf("The arc sin of %lf is %lf\n", x, result);
; K9 m- S" g% E9 p! ^  return(0);! I2 p1 x' G% I4 d  o" b; O9 o
  }
; h: Q. z% n/ D8 N8 H  函数名: assert' R' B6 W3 ?" P2 l4 P- @% X$ o
  功 能: 测试一个条件并可能使程序终止
4 [0 }- M8 @$ q  用 法: void assert(int test);5 t" @+ v3 ?, L
  程序例:" z8 `  o' l# d4 p: E1 W
  #include& e4 L( `" e- o- c* D  @7 y
  #include
! U! K9 x1 u3 z1 `# S3 J- }  #include& b4 e( l7 H" \  X& Y4 _, |' J
  struct ITEM {) j+ ~8 W$ _* O. x! Q1 b
  int key;
8 X- r% f* V6 d6 O  int value;
! W5 P# P2 x; D" ~3 U: k, K3 h7 q  };9 D0 H4 Q# I/ x$ J
  /* add item to list, make sure list is not null */- R9 s, Z* @! G2 T( c: o
  void additem(struct ITEM *itemptr) {! ?9 [  V& @% M  `+ l' }
  assert(itemptr != NULL);
, ~2 t7 H" w3 g  /* add item to list */; f: W' u2 X7 }) p  x
  }
9 x8 {! R6 }; j  int main(void)
; w' v8 v. U/ C/ b  {
- ?( P6 Z" _& j# r, }$ A  additem(NULL);. C9 |' c+ Y3 A0 `& ]
  return 0;7 s/ X# N% b/ F# Q
  }
) g# e% N) j  ~4 v 
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-17 09:46 , Processed in 0.385802 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表