C语言函数大全(e开头)

函数名: ecvt

功能: 把一个浮点数转换为字符串

用法: char ecvt(double value, int ndigit, int *decpt, int *sign);

程序例:

#include
#include
#include
int main(void)
{
char *string;
double value;
int dec, sign;
int ndig = 10;
clrscr();
value = 9.876;
string = ecvt(value, ndig, &dec, &sign);
printf("string = %s dec = %d \
sign = %d\n", string, dec, sign);
value = -123.45;
ndig= 15;
string = ecvt(value,ndig,&dec,&sign);
printf("string = %s dec = %d sign = %d\n",
string, dec, sign);

value = 0.6789e5; /* scientific
notation */
ndig = 5;
string = ecvt(value,ndig,&dec,&sign);
printf("string = %s dec = %d\
sign = %d\n", string, dec, sign);
return 0;
}

函数名: ellipse

功能: 画一椭圆

用法: void far ellipse(int x, int y, int stangle, int endangle,

int xradius, int yradius);

程序例:

#include
#include
#include
#include
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int stangle = 0, endangle = 360;
int xradius = 100, yradius = 50;
/* initialize graphics, local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk)
/* an error occurred */
{
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 ellipse */
ellipse(midx, midy, stangle, endangle,
xradius, yradius);
/* clean up */
getch();
closegraph();
return 0;
}

时间: 2024-10-03 22:25:41

C语言函数大全(e开头)的相关文章

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

函数名: abort 功能: 异常终止一个进程 用法: void abort(void); 程序例: #include #include int main(void) { printf("Calling abort()\n"); abort(); return 0; /* This is never reached */ } 函数名: abs 功能: 求整数的绝对值 用法: int abs(int i); 程序例: #include #include int main(void) {

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

C语言函数大全(c开头)

函数名: cabs 功能: 计算复数的绝对值 用法: double cabs(struct complex z); 程序例: #include #include int main(void) { struct complex z; double val; z.x = 2.0; z.y = 1.0; val = cabs(z); printf("The absolute value of %.2lfi %.2lfj is %.2lf", z.x, z.y, val); return 0;

C语言函数大全(d开头)

函数名: delay 功能: 将程序的执行暂停一段时间(毫秒) 用法: void delay(unsigned milliseconds); 程序例: /* Emits a 440-Hz tone for 500 milliseconds */ #include int main(void) { sound(440); delay(500); nosound(); return 0; } 函数名: delline 功能: 在文本窗口中删去一行 用法: void delline(void); 程序

C语言函数大全(g开头)

函数名: gcvt 功能: 把浮点数转换成字符串 用法: char *gcvt(double value, int ndigit, char *buf); 程序例: #include #include int main(void) { char str[25]; double num; int sig = 5; /* significant digits */ /* a regular number */ num = 9.876; gcvt(num, sig, str); printf("str

C语言函数大全(h开头)

函数名: harderr 功能: 建立一个硬件错误处理程序 用法: void harderr(int (*fptr)()); 程序例: /*This program will trap disk errors and prompt the user for action. Try running it with no disk in drive A: to invoke its functions.*/ #include #include #include #define IGNORE 0 #d

C语言函数大全(i开头)

函数名: imagesize 功能: 返回保存位图像所需的字节数 用法: unsigned far imagesize(int left, int top, int right, int bottom); 程序例: #include #include #include #include #define ARROW_SIZE 10 void draw_arrow(int x, int y); int main(void) { /* request autodetection */ int gdri

C语言函数大全(k开头)

函数名: kbhit 功能: 检查当前按下的键 用法: int kbhit(void); 程序例: #include int main(void) { cprintf("Press any key to continue:"); while (!kbhit()) /* do nothing */ ; cprintf("\r\nA key was pressed...\r\n"); return 0; } 函数名: keep 功能: 退出并继续驻留 用法: void

C语言函数大全(l开头)

函数名: labs 用法: long labs(long n); 程序例: #include #include int main(void) { long result; long x = -12345678L; result= labs(x); printf("number: %ld abs value: %ld\n", x, result); return 0; } 函数名: ldexp 功能: 计算value*2的幂 用法: double ldexp(double value,