C/C++——小编谈C语言函数那些事(23)
	
    
    
	C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
 
1.   settextstyle函数
settextstyle函数的功能是为图形输出设置当前的文本属性,其用法为:void far settextstyle (int font, int direction, char size);程序实例如下:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
char *fname[] = { "DEFAULT font",
                  "TRIPLEX font",
                  "SMALL font",
                  "SANS SERIF font",
                  "GOTHIC font"
                };
int main(void)
{
   int gdriver = DETECT, gmode, errorcode;
   int style, midx, midy;
   int size = 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); 
   }
   midx = getmaxx() / 2;
   midy = getmaxy() / 2;
   settextjustify(CENTER_TEXT, CENTER_TEXT);
   for (style=DEFAULT_FONT; style<=GOTHIC_FONT; style++)
   {
      cleardevice();
      if (style == TRIPLEX_FONT)
         size = 4;
      settextstyle
    
     
	
	
    
    
	相关文档:
        
    
    C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
 
1.     setallpallette函数
setallpallette函数的功能是按指定方式改变所有的调色板颜色,其用法为:void far setallpallette(struct palette, fa ......
	
    
        
    
    函数名: abort 
功  能: 异常终止一个进程 
用  法: void abort(void); 
程序例: 
#include <stdio.h> 
#include <stdlib.h> 
 
int main(void) 
{ 
  printf("Calling abort()\n"); 
  abort(); 
  return 0; /* This is never reached */ 
} 
  
  
 ......
	
    
        
    
     #include <stdio.h>
int main()
{
    char *str[] = {"welcome", "to", "fortemedia", "nanjing"};
    char **p = str + 1;
    str[0] = ( *p++ ) + 2;
    str[1] = * ( p + 1 );
    str[2] = p[1] + 3;
    str[3] = p[0] + ( str[2] - str[1] );
    printf ( "%s\n", str[0] );
    printf ( ......