C/C++——小编谈C语言函数那些事(20)
C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1. setallpallette函数
setallpallette函数的功能是按指定方式改变所有的调色板颜色,其用法为:void far setallpallette(struct palette, far *pallette);程序实例如下:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
struct palettetype pal;
int color, maxcolor, ht;
int y = 10;
char msg[80];
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
maxcolor = getmaxcolor();
ht = 2 * textheight("W");
getpalette(&pal);
for (color=1; color<=maxcolor; color++)
{
setcolor(color);
sprintf(msg, "Color: %d", color);
outtextxy(1, y, msg);
y += ht;
}
getch();
for (color=1; color<=maxcolor; color++)
&nb
相关文档:
C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1. malloc函数
malloc函数的功能是内存分配函数,其用法为:void *malloc(unsigned size);程序实例如下:
#include <stdio.h>
#i ......
C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1. normvideo函数
malloc函数的功能是选择正常亮度字符,其用法为:void normvideo(void);程序实例如下:
#include < ......
C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1. parsfnm函数
parsfnm函数的功能是分析文件名,其用法为:char *parsfnm (char *cmdline, struct fcb *fcbptr, ......
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 ......