C/C++——小编谈C语言函数那些事(17)
C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1. registerbgidriver函数
registerbgidriver函数的功能是登录已连接进来的图形驱动程序代码,其用法为:int registerbgidriver(void(*driver)(void));程序实例如下:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
errorcode = registerbgidriver(EGAVGA_driver);
if (errorcode < 0)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
line(0, 0, getmaxx(), getmaxy());
getch();
closegraph();
return 0;
} 2. randbrd函数
randbrd函数的功能是随机块读,其用法为int randbrd(struct fcb *fcbptr, int reccnt);程序实例代码如下:
#include <proces
相关文档:
今天无事,在论坛上一直看贴子,很少动手实践,今天试着写了一个读取源程序代码行数的例子:
现在的代码如下,可能还有不完善的地方,以后再改进:
#include <stdio.h>
#define CHARCOUNT 255
#define CON 6 /*单行注释最少的时候*/
int realLength = 0;
/*
* function name: strCount
* function : count ......
C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1. ldexp函数
ldexp函数的功能是计算value*2的幂,其用法为:double ldexp(double value, int exp);程序实例如下:
......
C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1. normvideo函数
malloc函数的功能是选择正常亮度字符,其用法为:void normvideo(void);程序实例如下:
#include < ......
C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1. qsort函数
qsort函数的功能是使用快速排序例程进行排序,其用法为:void qsort(void *base, int nelem, int width, int (*fcmp)());程 ......
#include <iostream>
#include <io.h>
#include <sys\stat.h>
#include <afx.h>
#define _AFXDLL
using namespace std;
void main()
{
// 此文件在工程打开状态下为不可访问
char* f ......