易截截图软件、单文件、免安装、纯绿色、仅160KB

C/C++——小编谈C语言函数那些事(4)

C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1.       delline函数
delline函数的功能是在文本窗口中删去一行,其用法为:void delline(void);程序例子如下:
#include <conio.h>
int main(void)
{
   clrscr();
   cprintf("The function DELLINE deletes \
    the line containing the\r\n");
   cprintf("cursor and moves all lines \
    below it one line up.\r\n");
   cprintf("DELLINE operates within the \
    currently active text\r\n");
   cprintf("window.  Press any key to \
    continue . . .");
   gotoxy(1,2);  /* Move the cursor to the
      second line and first column */
   getch();
   delline();
   getch();
   return 0;
}
2.       detectgraph函数
detectgraph函数的功能是通过检测硬件确定图形驱动程序和模式,其用法为:void far detectgraph(int far *graphdriver, int far *graphmode); 程序例子如下:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
/* names of the various cards supported */
char *dname[] = { "requests detection",
    "a CGA",
    "an MCGA",
    "an EGA",
    "a 64K EGA",
    "a monochrome EGA",
    "an IBM 8514",
    "a Hercules monochrome",
    "an AT&T 6300 PC",
    "a VGA",
    "an IBM 3270 PC"
  };
int main(void)
{
   /* returns detected hardware info. */
   int gdriver, gmode, errorcode;
  /* detect graphics hardware available */
   detectgraph(&gdriver, &gmode);
   /* read result of detectgraph call */


相关文档:

C/C++ Newbie's FAQ

 
Part I 如何上路
1. vi, vim是编译器么?
vi means visual editor,是软件世界第一个全屏幕编辑器,最初的作者是现在Sun microsystem的Bill Joy。
vim means Vi IMproved,可以看作是增强的vi。
很不幸,他们都不是编译器,如果你已经写好了first.c,那么不能指望vi们将你的源代码变成执行程序。
2. gcc, ......

C/C++数组名与指针区别

 以下文章转载于:为了学习和收藏
http://tech.163.com/school · 2005-08-23 11:05:18 · 来源: 天极网
C/C++数组名与指针区别
  引言
  指针是C/C++语言的特色,而数组名与指针有太多的相似,甚至很多时候,数组名可以作为指针使用。于是乎,很多程序设计者就被搞糊涂了。而许多的大学老师,他们 ......

C中宏#和##的运用

 #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#define f(a,b) a##b
#define g(a)  #a
#define h(a) g(a)
int main()   
{   
    char a = 'a';      
    ......

C/C++/VC++ 变量命名规则

C/C++/VC++ 变量命名规则
是VC++的么?
4.变量风格
变量尽量采用匈牙利命名法,同时结合VC的原则;一般情况下,变量的取名方式为:
<scope><prefix><qualifier>
有关项目的全局变量必须用g_开始,类成员变量用m_,局部变量若函数较大则可考虑用l_用以显示说明其是局部变量。
前缀
类型
示例
g_ ......

C和C++混合编程相关问题解决方法

一 :解决C或C++中的multiple definition of问题
server.cpp
clientp2p.cpp
#include "exception.h"
#include "clientp2p.h"
clientp2p.h
中写有所有的全局变量及其初始化值
和函数声明
1.server.cpp中:
引用

#include "clientp2p.h"
int Main(....)
{
...
}
2.clientp ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号