第一范文网 - 专业文章范例文档资料分享平台

C语言基础教程

来源:用户分享 时间:2025/5/31 6:01:25 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

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(\

return 0; }

函数名: asin

功 能: 反正弦函数

用 法: double asin(double x); 程序例:

#include #include

int main(void) {

double result; double x = 0.5;

result = asin(x);

printf(\ return(0); }

函数名: assert

功 能: 测试一个条件并可能使程序终止 用 法: void assert(int test); 程序例:

#include #include #include

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

int main(void) {

double result; double x = 0.5;

result = atan(x);

printf(\ return(0); }

函数名: atan2

功 能: 计算Y/X的反正切值

用 法: double atan2(double y, double x); 程序例:

#include #include

int main(void) {

double result;

double x = 90.0, y = 45.0;

result = atan2(y, x);

printf(\ return 0; }

函数名: atexit

功 能: 注册终止函数

用 法: int atexit(atexit_t func); 程序例:

#include #include

void exit_fn1(void) {

printf(\ }

void exit_fn2(void) {

printf(\ }

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

int main(void) {

float f;

char *str = \

f = atof(str);

printf(\ return 0; }

函数名: atoi

功 能: 把字符串转换成长整型数 用 法: int atoi(const char *nptr); 程序例:

#include #include

int main(void) { int n;

char *str = \

n = atoi(str);

printf(\ return 0; }

函数名: atol

功 能: 把字符串转换成长整型数 用 法: long atol(const char *nptr); 程序例:

#include #include

int main(void) {

long l;

char *str = \

l = atol(lstr);

printf(\ return(0); }

C语言基础教程(三十三)

网上收集整理 函数篇(b)

函数名: bar

功 能: 画一个二维条形图

用 法: void far bar(int left, int top, int right, int bottom); 程序例:

#include #include #include #include

int main(void) {

/* request auto detection */

int gdriver = DETECT, gmode, errorcode; int midx, midy, i;

/* initialize graphics and local variables */ initgraph(&gdriver, &gmode, \

/* read result of initialization */ errorcode = graphresult();

if (errorcode != grOk) /* an error occurred */ {

printf(\ printf(\ getch();

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

midx = getmaxx() / 2; midy = getmaxy() / 2;

/* loop through the fill patterns */

for (i=SOLID_FILL; i

/* set the fill style */

setfillstyle(i, getmaxcolor());

/* draw the bar */

bar(midx-50, midy-50, midx+50, midy+50);

getch();

搜索更多关于: C语言基础教程 的文档
C语言基础教程.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c8a1ou1x73m28mwx144wv_10.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top