如何使用_Turbo_C
TurboC语言概述

TurboC语言概述简介TurboC是一种经典的C语言集成开发环境〔IDE〕,由Borland公司开发并于1990年发布。
作为C语言开发的先驱,TurboC在当时的计算机编程领域具有重要的地位。
它提供了一个强大的开发环境,帮助开发者编写和调试C语言程序。
开发环境TurboC最初是为MS-DOS操作系统开发的,它提供了一个友好的图形用户界面〔GUI〕,让开发者能够轻松地编辑、编译、运行和调试C语言程序。
TurboC还提供了集成的调试器,让开发者能够快速定位和修复代码中的错误。
功能特点TurboC具有许多强大的功能特点,使其成为当时最受欢送的C语言开发工具之一。
编译器TurboC的编译器具有出色的性能和高效的编译速度。
它能够将C 语言源代码转换为可执行的机器代码,从而实现程序的运行。
编辑器TurboC的编辑器提供了许多方便的编辑功能,如代码高亮显示、自动补全和代码折叠等。
它还支持多文件编辑,使开发者能够同时编辑多个源文件。
调试器TurboC的调试器是其最大的特点之一。
它允许开发者逐行执行代码,检查变量的值,设置断点和监视表达式等。
调试器还提供了单步执行、跳过和跳入函数等功能,帮助开发者更好地理解程序的执行过程。
库函数TurboC内置了许多常用的库函数,如输入输出函数、字符串处理函数和数学函数等。
这些库函数能够满足开发者各种不同的需求,极大地提高了程序的开发效率。
TurboC的影响TurboC的发布对计算机编程产生了深远的影响。
它让C语言的学习和使用变得更加容易和高效,吸引了大量的开发者选择C语言作为他们的主要开发语言。
同时,TurboC也为其他集成开发环境的开展奠定了根底,如Microsoft Visual C++和Eclipse等。
虽然TurboC已经过时并不再被广泛使用,但它的影响依然存在。
许多C语言的根底教程和例如代码仍然使用TurboC作为开发工具。
此外,TurboC的开发理念和设计思想影响了许多后来的C语言开发环境,成为了现代集成开发环境的基石。
C语言编程工具Turboc 2.0里怎么复制然后粘贴

百度首页| 百度知道| 登录乐享新春,我有经验!你在美食、时尚、购物方面有亲身经验么?快来分享吧!你会有机会获得nano等礼物并和文怡、小p 老师互动查看新闻网页贴吧知道MP3图片视频百科文库帮助|设置百度知道> 电脑/网络> 程序设计> C/C++C语言编程工具Turboc 2.0里怎么复制然后粘贴悬赏分:10|提问时间:2008-10-14 19:02|提问者:tzmtyqy|问题为何被关闭怎么操作呀,右键又没有用,菜单里面也没有其他回答共5条好像不能,但你可以保存文件后在turboc的文件夹里找你刚才保存的那个文件名字的有个好像是C程序文件的东西,就是一张纸上有个大写C的文件,可以用记事本打开的,然后复制,再打开另一个后粘贴上回答者:方格围巾|一级|2008-10-14 19:15 选定之后按ctrl+insert复制,然后找到地方按shift+insert粘贴。
你可以试一下,在其它地方也可以。
回答者:liukelk|六级|2008-10-14 19:16 平时windows的复制只需要用鼠标选取一块文本,然后就Ctrl+C,Ctrl+V.TC2,编辑器有块操作.TC2选取文本也要用键盘.....Ctrl+K然后B.来定义块的开始.Ctrl+K,然后K.这是标记块的结束.比如有一行:(光标在这里按Ctrl+K,然后再按B)int i[100];(光标在这里按Ctrl+K,然后再按K)你看这一行是不是选上了...然后你把光标移动到想要复制的地方,按Ctrl+K,再按C.....剪切呢...(TC2里面就是块的移动),Ctrl+K,V这个在TC的帮助文档里有,你可以在编辑状态按F1,然后看看..推荐你使用TC++3 或者BC++3,虽然是DOS,但是支持鼠标选取,用Ctrl+insert复制,shift+insert粘贴...(Edit菜单里有说明的.呵呵)其实这里的热键是DOS时代的热键,直到现在windows还支持(个人猜测是微软为了迎合老程序员的习惯,然后一直保留了..),不信你用记事本试试...嗯,TC3++或者BC3++的帮助很好,包括C/C++标准库的头文件的说明,数据类型,库函数的说明,都很全.很适合初学者.回答者:萧の十三郎|七级|2008-10-14 21:57在TC2.0编辑器中,没有剪贴板的概念,因此不能用现在Windows的剪贴板思维对待. TC2.0中是先定义一个复制区域,然后在需要复制的地方点复制快捷键,就完成了复制.1、复制区域的定义在复制起始点按Ctrl+K+B在复制结束点按Ctrl+K+K编辑器会装你需要复制的部分以高亮显示.2、进行复制然后在你需要复制的地方点Ctrl+K+C, 内容就复制了.如果按Ctrl+K+M,就是移动了。
c语言程序设计基本步骤

c语言程序设计基本步骤一、turbo c程序设计基本步骤程序设计方法包括三个基本步骤:第一步: 分析问题。
第二步: 画出程序的基本轮廓。
第三步: 实现该程序。
3a. 编写程序3b. 测试和调试程序3c. 提供数据打印结果下面, 我们来说明每一步的具体细节。
第一步: 分析问题在这一步, 你必须:a. 作为解决问题的一种方法, 确定要产生的数据(输出)。
作为这一子步的一部分, 你应定义表示输出的变量。
b. 确定需产生输出的数据(称为输入), 作为这一子步的一部分, 你应定义表示输入的变量。
c. 研制一种算法, 从有限步的输入中获取输出。
这种算法定义为结构化的顺序操作, 以便在有限步内解决问题。
就数字问题而言, 这种算法包括获取输出的计算, 但对非数字问题来说, 这种算法包括许多文本和图象处理操作。
第二步: 画出程序的基本轮廓在这一步, 你要用一些句子(伪代码)来画出程序的基本轮廓。
每个句子对应一个简单的程序操作。
对一个简单的程序来说, 通过列出程序顺序执行的动作,便可直接产生伪代码。
然而, 对复杂一些的程序来说, 则需要将大致过程有条理地进行组织。
对此, 应使用自上而下的设计方法。
当使用自上而下的设计方法时, 你要把程序分割成几段来完成。
列出每段要实现的任务, 程序的轮廓也就有了, 这称之为主模块。
当一项任务列在主模块时,仅用其名加以标识, 并未指出该任务将如何完成。
这方面的内容留给程序设计的下一阶段来讨论。
将程序分为几项任务只是对程序的初步设计。
整个程序设计归结为下图所示的流程图1.。
┏━━━━━━━━━━━━━━━┓┃ 主模块┃┏━━━━━━━┓ ┃ 输入数据┃┃ 主模块┃ ┃ 计算购房所需的金额┃┃ ┃ ┃ 计算装修所需的金额┃┃ 任务1 ┃ ┃ 计算总金额┃┃ 任务2 ┃ ┃ 输出计算结果┃┃ 任务3 ┃ ┃ ┃┃ 任务4 ┃ ┗━━━━━━━┳━━━━━━━┛┃ ┃ ┏━━━━━┳━━━━━╋━━━━┳━━━━━┓┃ ┃ ┏━━┻━┓┏━━┻━┓┏━━┻━┓┏━┻━┓┏━━┻━┓┗━━━━━━━┛ ┃输入数据┃┃购房额..┃┃装修额..┃┃总额..┃┃输出结果┃┗━━━━┛┗━━━━┛┗━━━━┛┗━━━┛┗━━━━┛图1. 程序初步设计图2. 第二级程序设计如果把主模块的每项任务扩展成一个模块, 并根据子任务进行定义的话, 那么, 程序设计就更为详细了(见图2.)。
TurboC2.0、BorlandC库函数及用例解读

Turbo C 2.0、Borland 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){int number = -1234; printf("number:%d absolute value:%d\n",number,abs(number)); return 0;}函数名: absread功能: 绝对磁盘扇区读数据用法: int absread( int drive, int nsects, int sectno,void *buffer );程序例:/* absread example */#include#include#include#include int main(void){int i, strt, ch_out, sector;char buf[512]; printf("Insert diskette into drive A press any key\n");getch();sector = 0;if (absread(0, 1, sector, &buf) != 0){ perror("Disk problem");exit(1); }printf("Read OK\n");strt = 3;for (i=0; i#include#include#include int main(void){ int i, strt, ch_out, sector;char buf[512]; printf("Insert diskette into drive A press any key\n"); getch();sector = 0;if (absread(0, 1, sector, &buf) != 0){ perror("Disk problem");exit(1); }printf("Read OK\n");strt = 3;for (i=0; i#include int file_exists(char *filename);int main(void){ printf("Does NOTEXIST.FIL exist: %s\n",file_exists("NOTEXISTS.FIL") ? "YES" : "NO");return 0;}int file_exists(char *filename){return (access(filename, 0) == 0);}函数名: acos功能: 反余弦函数用法: double acos(double x);程序例:#include#include int main(void){ double result;double x = 0.5;result = acos(x);printf("The arc cosine of %lf is %lf\n", x, result);return 0;}函数名: allocmem功能: 分配DOS存储段用法: int allocmem(unsigned size, unsigned *seg);程序例:#include#include#include int main(void){unsigned int size, segp;int stat;size = 64; /* (64 x 16) = 1024 bytes */stat = allocmem(size, &segp); if (stat == -1)printf("Allocated memory at segment: %x\n", segp);elseprintf("Failed: maximum number of paragraphs available\is %u\n", stat);return 0;}函数名: arc功能: 画一弧线用法: void far arc( int x,int y,int stangle,int endangle,int radius );程序例:#include#include#include#include int main(void){ /* request auto detection */int gdriver = DETECT, gmode, errorcode;int midx, midy; int stangle = 45, endangle = 135;int radius = 100;/* initialize graphics and local variables */initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); /* an error occurred */if (errorcode != grOk){printf("Graph err: %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 arc */arc(midx, midy, stangle, endangle, radius); /* clean up */getch();closegraph();return 0;}函数名: asctime功能: 转换日期和时间为ASCII码用法: char *asctime(const struct tm *tblock);程序例:#include#include#include int main(void){struct tm t;char str[80]; /* sample loading of tm structure */ t.tm_sec = 1; /* Seconds */t.tm_min = 30; /* Minutes */t.tm_hour = 9; /* Hour */t.tm_mday = 22; /* Day of the Month */t.tm_mon = 11; /* Month */t.tm_year = 56; /* Year - does not include century */ t.tm_wday = 4; /* Day of the week */t.tm_yday = 0; /* Does not show in asctime */t.tm_isdst = 0;/* Is Daylight SavTime; does not show in asctime *//* converts structure to null terminatedstring */ strcpy(str, asctime(&t));printf("%s\n", str);return 0;}函数名: asin功能: 反正弦函数用法: double asin(double x);程序例:#include#include int main(void){ double result;double x = 0.5;result = asin(x);printf("The arc sin of %lf is %lf\n", x, result);return(0);}函数名: assert功能: 测试一个条件并可能使程序终止用法: void assert(int test);程序例:#include#include#include struct ITEM {int key;int value;};/* add item to list, make sure list is not null */void additem(struct ITEM *itemptr) {assert(itemptr != NULL);}int main(void){additem(NULL);return 0;}函数名: atan功能: 反正切函数用法: double atan(double x);程序例:#include#includeint main(void){ double result;double x = 0.5;result = atan(x);printf("The arc tangent of %lf is %lf\n", x, result); return(0);}函数名: atan2功能: 计算Y/X的反正切值用法: double atan2(double y, double x);程序例:#include#include int main(void){ double result;double x = 90.0, y = 45.0;result = atan2(y, x);printf("The arc tangent ratio of %lf is %lf\n\", (y/x),result);return 0;}函数名: atexit功能: 注册终止函数用法: int atexit(atexit_t func);程序例:#include#include void exit_fn1(void){ printf("Exit function #1 called\n");}void exit_fn2(void){ printf("Exit function #2 called\n");}int main(void){/* post exit function #1 */atexit(exit_fn1);/* post exit function #2 */atexit(exit_fn2);return 0;}函数名: atof功能: 把字符串转换成浮点数用法: double atof(const char *nptr);程序例:#include#includeint main(void){ float f;char *str = "12345.67";f = atof(str); printf("string = %s float = %f\n", str, f); return 0;}函数名: atoi功能: 把字符串转换成长整型数用法: int atoi(const char *nptr);程序例:#include#include int main(void){ int n;char *str = "12345.67";n = atoi(str);printf("string = %s integer = %d\n", str, n);return 0;}函数名: atol功能: 把字符串转换成长整型数用法: long atol(const char *nptr);程序例:#include#include int main(void){ long l;char *str = "98765432";l = atol(lstr);printf("string = %s integer = %ld\n", str, l);return(0);}字母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 and local variables */initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult();if (errorcode != grOk) /* an error occurred */{printf("Graph err: %s\n", grapherrormsg(errorcode));printf("Press any key to halt:");getch();exit(1); /* terminate with an error code */}midx = getmaxx() / 2;midy = getmaxy() / 2; /* loop through the fill patterns */for (i=SOLID_FILL; i#include#include#include int main(void){ /* request auto detection */int gdriver = DETECT, gmode, errorcode;int midx, midy, i; /* initialize graphics, local variables */initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult();if (errorcode != grOk) /* an error occurred */{printf("Graph err: %s\n", grapherrormsg(errorcode));printf("Press any key to halt:");getch();exit(1); /* terminate with error code */} midx = getmaxx() / 2;midy = getmaxy() / 2;/* loop through the fill patterns */for (i=EMPTY_FILL; i#include /* Get current drive as 'A', 'B', ... */char current_drive(void){char curdrive; /* Get current disk as 0, 1, ... */curdrive = bdos(0x19, 0, 0);return('A' + curdrive);}int main(void){printf("The current drive is %c:\n", current_drive());return 0;}函数名: bdosptr功能: DOS系统调用用法: int bdosptr( int dosfun, void *argument,unsigned dosal );程序例:#include#include#include#include#include#include #define BUFLEN 80int main(void){char buffer[BUFLEN];int test; printf("Enter full pathname of a directory\n");gets(buffer); test = bdosptr(0x3B,buffer,0);if(test){ printf("DOS error message: %d\n", errno);/* See errno.h for error listings */exit (1);} getcwd(buffer, BUFLEN);printf("The current directory is: %s\n", buffer); return 0;}函数名: bioscom功能: 串行I/O通信用法: int bioscom(int cmd, char abyte, int port);程序例:#include#include #define COM1 0#define DATA_READY 0x100#define TRUE 1#define FALSE 0#define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)int main(void) {int in, out, status, DONE = FALSE; bioscom(0, SETTINGS, COM1);cprintf("... BIOSCOM [ESC] to exit ...\n");while (!DONE){status = bioscom(3, 0, COM1);if (status & DATA_READY)if ((out = bioscom(2, 0, COM1) & 0x7F) != 0)putch(out); if (kbhit()){if ((in = getch()) == '\x1B')DONE = TRUE;bioscom(1, in, COM1);}}return 0;}函数名: biosdisk功能: 软硬盘I/O用法: int biosdisk( int cmd,int drive,int head,int track,int sector,int nsects, void *buffer);程序例:#include#include int main(void){int result;char buffer[512]; printf("Testing to see if drive a: is ready\n");result = biosdisk(4,0,0,0,0,1,buffer);result &= 0x02;(result) ? (printf("Drive A: Ready\n")) :(printf("Drive A: Not Ready\n"));return 0;}函数名: biosequip功能: 检查设备用法: int biosequip(void);程序例:#include#include int main(void){int result;char buffer[512]; printf("Testing to see if drive a: is ready\n");result = biosdisk(4,0,0,0,0,1,buffer);result &= 0x02;(result) ? (printf("Drive A: Ready\n")) :(printf("Drive A: Not Ready\n")); return 0;}函数名: bioskey功能: 直接使用BIOS服务的键盘接口用法: int bioskey(int cmd);程序例:#include#include#include #define RIGHT 0x01#define LEFT 0x02#define CTRL 0x04#define ALT 0x08int main(void){int key, modifiers; /* function 1 returns 0 until a key is pressed */while (bioskey(1) == 0); /* function 0 returns the key that is waiting */ key = bioskey(0); /* use function 2 to determine if shift keys were used */ modifiers = bioskey(2); if (modifiers){printf("[");if (modifiers & RIGHT) printf("RIGHT");if (modifiers & LEFT) printf("LEFT");if (modifiers & CTRL) printf("CTRL");if (modifiers & ALT) printf("ALT");printf("]");}/* print out the character read */if (isalnum(key & 0xFF))printf("'%c'\n", key);else printf("%#02x\n", key);return 0;}函数名: biosmemory功能: 返回存储块大小用法:int biosmemory(void);程序例:#include#includeint main(void){int memory_size;memory_size = biosmemory();/* returns value up to 640K */printf("RAM size = %dK\n",memory_size);return 0;}函数名: biosprint功能: 直接使用BIOS服务的打印机I/O用法: int biosprint(int cmd, int byte, int port);程序例:#include#include#include int main(void){#define STATUS 2 /* printer status command */#define PORTNUM 0 /* port number for LPT1 */ int status, abyte=0; printf("Please turn off your printer.\Press any key to continue\n");getch();status = biosprint(STATUS, abyte, PORTNUM);if (status & 0x01)printf("Device time out.\n");if (status & 0x08)printf("I/O error.\n"); if (status & 0x10)printf("Selected.\n");if (status & 0x20)printf("Out of paper.\n"); if (status & 0x40)printf("Acknowledge.\n");if (status & 0x80)printf("Not busy.\n"); return 0;}函数名: biostime功能: 读取或设置BIOS时间用法: long biostime(int cmd, long newtime);程序例:#include#include#include#include int main(void){long bios_time;clrscr(); cprintf("The number of clock ticks since midnight\is:\r\n");cprintf("The number of seconds since midnight is:\r\n");cprintf("The number of minutes since midnight is:\r\n");cprintf("The number of hours since midnight is:\r\n");cprintf("\r\nPress any key to quit:");while(!kbhit()){bios_time = biostime(0, 0L); gotoxy(50, 1);cprintf("%lu", bios_time); gotoxy(50, 2);cprintf("%.4f", bios_time / CLK_TCK); gotoxy(50, 3);cprintf("%.4f", bios_time / CLK_TCK / 60); gotoxy(50, 4);cprintf("%.4f", bios_time / CLK_TCK / 3600);}return 0;}函数名: brk功能: 改变数据段空间分配用法: int brk(void *endds);程序例:#include#include int main(void){char *ptr; printf("Changing allocation with brk()\n");ptr = malloc(1); printf("Before brk() call:%lu bytes free\n",coreleft()); brk(ptr+1000);printf(" After brk() call:%lu bytes free\n",coreleft());}函数名: bsearch功能: 二分法搜索用法: void *bsearch( const void *key, const void *base,size_t *nelem, size_t width,int(*fcmp)(const void *, const *));程序例:#include#include#define NELEMS(arr) (sizeof(arr) / sizeof(arr[0]))int numarray[] = {123, 145, 512, 627, 800, 933};int numeric (const int *p1, const int *p2){return(*p1 - *p2);}int lookup(int key){int *itemptr; /* The cast of (int(*)(const void *,const void*))is needed to avoid a type mismatch error atcompile time */itemptr = bsearch (&key, numarray, NELEMS(numarray),sizeof(int), (int(*)(const void *,const void *))numeric);return (itemptr != NULL);}int main(void){if (lookup(512))printf("512 is in the table.\n");elseprintf("512 isn't in the table.\n"); return 0;}字母C开头函数函数名: cabs功能: 计算复数的绝对值用法: double cabs(struct complex z);程序例:#include#includeint 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);}函数名: calloc功能: 分配主存储器用法: void *calloc(size_t nelem, size_t elsize);程序例:#include#include int main(void){char *str = NULL;/* allocate memory for string */str = calloc(10, sizeof(char));/* copy "Hello" into string */ strcpy(str, "Hello");/* display string */printf("String is %s\n", str);/* free memory */free(str);return 0;}函数名: ceil功能: 向上舍入用法: double ceil(double x);程序例:#include#include int main(void){double number = 123.54;double down, up; down = floor(number); up = ceil(number); printf("original number %5.2lf\n", number);printf("number rounded down %5.2lf\n", down);printf("number rounded up %5.2lf\n", up); return 0;}函数名: cgets功能: 从控制台读字符串用法: char *cgets(char *str);程序例:#include#include int main(void){char buffer[83];char *p;/* There's space for 80 characters plus the NULL \terminator */ buffer[0] = 81; printf("Input some chars:");p = cgets(buffer);printf("\ncgets read %d characters: \"%s\"\n\", buffer[1], p);printf("The returned pointer is %p, buffer[0] is at %p\n\", p, &buffer);/* Leave room for 5 characters plus the NULL terminator */buffer[0] = 6; printf("Input some chars:");p = cgets(buffer);printf("\ncgets read %d characters: \"%s\"\n\", buffer[1], p); printf("The returned pointer is %p, buffer[0] isat %p\n\", p, &buffer);return 0;}函数名: chdir功能: 改变工作目录用法: int chdir(const char *path);程序例:#include#include#include char old_dir[MAXDIR];char new_dir[MAXDIR];int main(void){if (getcurdir(0, old_dir)){ perror("getcurdir()");exit(1);}printf("Current directory is: \\%s\n", old_dir);if (chdir("\\")){ perror("chdir()");exit(1);}if (getcurdir(0, new_dir)){ perror("getcurdir()");exit(1);} printf("Current directory is now: \\%s\n", new_dir); printf("\nChanging back to orignal directory: \\%s\n\", old_dir);if (chdir(old_dir)){ perror("chdir()");exit(1);}return 0;}函数名: _chmod, chmod功能: 改变文件的访问方式用法: int chmod(const char *filename, int permiss);程序例:#include#include#include void make_read_only(char *filename);int main(void){ make_read_only("NOTEXIST.FIL");make_read_only("MYFILE.FIL"); return 0;}void make_read_only(char *filename){ int stat;stat = chmod(filename, S_IREAD);if (stat)printf("Couldn't make %s read-only\n", filename);elseprintf("Made %s read-only\n", filename);}函数名: chsize功能: 改变文件大小用法: int chsize(int handle, long size);程序例:#include#include#include int main(void){int handle;char buf[11] = "0123456789";/* create text file containing 10 bytes */handle = open("DUMMY.FIL", O_CREAT);write(handle, buf, strlen(buf)); /* truncate the file to 5 bytes in size */ chsize(handle, 5); /* close the file */close(handle);return 0;}函数名: circle功能: 在给定半径以(x, y)为圆心画圆用法: void far circle(int x, int y, int radius);程序例:#include#include#include#include int main(void){/* request auto detection */int gdriver = DETECT, gmode, errorcode; int midx, midy;int radius = 100; /* initialize graphics and 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 the circle */circle(midx, midy, radius); /* clean up */getch();closegraph();return 0;}函数名: cleardevice功能: 清除图形屏幕用法: void far cleardevice(void);程序例:#include#include#include#include int main(void){/* request auto detection */int gdriver = DETECT, gmode, errorcode; int midx, midy; /* initialize graphics and 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()); /* for centering screen messages */settextjustify(CENTER_TEXT, CENTER_TEXT); /* output a message to the screen */ outtextxy(midx,midy,"press any key to clear the screen:"); /* wait for a key */ getch(); /* clear the screen */cleardevice(); /* output another message */outtextxy(midx, midy, "press any key to quit:"); /* clean up */getch();closegraph();return 0;}函数名: clearerr功能: 复位错误标志用法:void clearerr(FILE *stream);程序例:#include int main(void){FILE *fp;char ch; /* open a file for writing */fp = fopen("DUMMY.FIL", "w"); /* force an error condition by attempting to read */ch = fgetc(fp);printf("%c\n",ch); if (ferror(fp)){/* display an error message */printf("Error reading from DUMMY.FIL\n"); /* reset the error and EOF indicators */clearerr(fp);} fclose(fp);return 0;}函数名: clearviewport功能: 清除图形视区用法: void far clearviewport(void);程序例:#include#include#include#include #define CLIP_ON 1 /* activates clipping in viewport */int main(void) { /* request auto detection */int gdriver = DETECT, gmode, errorcode;int ht; /* initialize graphics and 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 */} setcolor(getmaxcolor());ht = textheight("W"); /* message in default full-screen viewport */outtextxy(0, 0, "* <-- (0, 0) in default viewport"); /* create a smaller viewport */setviewport(50, 50, getmaxx()-50, getmaxy()-50, CLIP_ON);/* display some messages */outtextxy(0, 0, "* <-- (0, 0) in smaller viewport");outtextxy(0, 2*ht, "Press any key to clear viewport:"); /* wait for a key */ getch(); /* clear the viewport */clearviewport(); /* output another message */outtextxy(0, 0, "Press any key to quit:"); /* clean up */ getch();closegraph();return 0;}函数名: _close, close功能: 关闭文件句柄用法: int close(int handle);程序例:#include#include#include#include main(){int handle;char buf[11] = "0123456789"; /* create a file containing 10 bytes */ handle = open("NEW.FIL", O_CREAT);if (handle > -1){write(handle, buf, strlen(buf)); /* close the file */close(handle);}else{printf("Error opening file\n");} return 0;}函数名: clock功能: 确定处理器时间用法: clock_t clock(void);程序例:#include#include#include int main(void){clock_t start, end;start = clock();delay(2000); end = clock();printf("The time was: %f\n", (end - start) / CLK_TCK); return 0;}函数名: closegraph功能: 关闭图形系统用法: void far closegraph(void);程序例:#include#include#include#include int main(void){/* request auto detection */int gdriver = DETECT, gmode, errorcode; int x, y; /* initialize graphics mode */initgraph(&gdriver, &gmode, ""); /* read result of initialization */errorcode = graphresult(); if (errorcode != grOk) /* an erroroccurred */{printf("Graphics error: %s\n\", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch();exit(1); /* terminate with an error code */}x = getmaxx() / 2;y = getmaxy() / 2; /* output a message */settextjustify(CENTER_TEXT, CENTER_TEXT);outtextxy(x, y, "Press a key to close the graphics \system:"); /* wait for a key */getch();/* closes down the graphics system */closegraph(); printf("We're now back in text mode.\n");printf("Press any key to halt:");getch();return 0;}函数名: clreol功能: 在文本窗口中清除字符到行末用法: void clreol(void);程序例:#include int main(void){clrscr();cprintf("The function CLREOL clears all characters from\the\r\n");cprintf("cursor position to the end of the line within\the\r\n"); cprintf("current text window, without moving the cursor.\\r\n");cprintf("Press any key to continue . . .");gotoxy(14, 4);getch();clreol();getch();return 0;}函数名: clrscr功能: 清除文本模式窗口用法: void clrscr(void);程序例:#include int main(void){int i;clrscr();for (i = 0; i < 20; i++)cprintf("%d\r\n", i);cprintf("\r\nPress any key to clear screen");getch(); clrscr();cprintf("The screen has been cleared!");getch();return 0;}函数名: coreleft功能: 返回未使用内存的大小用法: unsigned coreleft(void);程序例:#include#include int main(void){printf("The difference between the highest allocated \block and\n");printf("the top of the heap is: %lu bytes\n\", (unsigned long) coreleft());return 0;}函数名: cos功能: 余弦函数用法: double cos(double x);程序例:#include#include int main(void){double result;double x = 0.5; result = cos(x); printf("The cosine of %lf is %lf\n", x, result); return 0;}函数名: cosh功能: 双曲余弦函数用法: dluble cosh(double x);程序例:#include#include int main(void){double result;double x = 0.5; result = cosh(x); printf("The hyperboic cosine of %lf is %lf\n",x,result);return 0;}函数名: country功能: 返回与国家有关的信息用法: struct COUNTRY *country( int countrycode,struct country *country);程序例:#include#include #define USA 0int main(void){struct COUNTRY country_info; country(USA, &country_info);printf("The currency symbol for the USA is: %s\n",country_info.co_curr);return 0;}函数名: cprintf功能: 送格式化输出至屏幕用法: int cprintf(const char *format[, argument, ...]);程序例:#include int main(void){/* clear the screen */clrscr(); /* create a text window */window(10, 10, 80, 25); /* output some text in the window */cprintf("Hello world\r\n"); /* wait for a key */getch();return 0;}函数名: cputs功能: 写字符到屏幕用法: void cputs(const char *string);程序例:#include int main(void){/* clear the screen */clrscr(); /* create a text window */window(10, 10, 80, 25); /* output some text in the window */cputs("This is within the window\r\n"); /* wait for a key */getch();return 0;}函数名: _creat, creat功能: 创建一个新文件或重写一个已存在的文件用法: int creat (const char *filename, int permiss);程序例:#include#include#include#include int main(void){int handle;char buf[11] = "0123456789"; /* change the default file mode from text to binary */_fmode = O_BINARY; /* create a binary file for reading and writing */handle = creat("DUMMY.FIL", S_IREAD | S_IWRITE); /* write 10 bytes to the file */ write(handle, buf, strlen(buf)); /* close the file */close(handle);return 0;}函数名: creatnew功能: 创建一个新文件用法: int creatnew(const char *filename, int attrib);程序例:#include#include#include#include#include int main(void){int handle; char buf[11] = "0123456789"; /* attempt to create a file that doesn't already exist */handle = creatnew("DUMMY.FIL", 0); if (handle == -1)printf("DUMMY.FIL already exists.\n");else{printf("DUMMY.FIL successfully created.\n");write(handle, buf, strlen(buf));close(handle);} return 0;}函数名: creattemp功能: 创建一个新文件或重写一个已存在的文件用法: int creattemp(const char *filename, int attrib);程序例:#include#include#include int main(void){int handle;char pathname[128];strcpy(pathname, "\\");/* create a unique file in the root directory */handle = creattemp(pathname, 0);printf("%s was the unique file created.\n", pathname);close(handle);return 0;}函数名: cscanf功能: 从控制台执行格式化输入用法: int cscanf(char *format[,argument, ...]);程序例:#include int main(void){char string[80]; /* clear the screen */clrscr();/* Prompt the user for input */cprintf("Enter a string with no spaces:"); /* read the input */ cscanf("%s", string); /* display what was read */cprintf("\r\nThe string entered is: %s", string);return 0;}函数名: ctime功能: 把日期和时间转换为字符串用法: char *ctime(const time_t *time);程序例:#include#include int main(void){time_t t; time(&t);printf("Today's date and time: %s\n", ctime(&t)); return 0;}函数名: ctrlbrk功能: 设置Ctrl-Break处理程序用法: void ctrlbrk(*fptr)(void);程序例:#include#include #define ABORT 0int c_break(void){printf("Control-Break pressed. Program aborting ...\n");return (ABORT);}int main(void){ctrlbrk(c_break);for(;;){ printf("Looping... Press to quit:\n");}return 0;}字母D开头函数函数名: delay。
Turbo C函数大全

T urbo C函数alloc.hbrk【功能】更改数据段空间的分配【原型】int brk(void *endds)【位置】alloc.h【说明】将程序数据段的顶部设置为endds所指向的内存位置。
调用成功之后,返回0。
如果调用失败则返回-1,同时设置errno。
【参见】coreleftcalloc【功能】分配内存。
【原型】void *calloc(size_t nelem,size_t elsize)【位置】stdib.h,alloc.h【说明】为nelem数据项的每elsize个字节分别分配空间,同时在空间中保存0值。
返回一个指向新分配块的指针,如果没有足够的空间则返回NULL。
【参见】malloccoreleft【功能】返回测出的未使用内存量。
【原型】小型模块中unsigend long coreleft(void)【位置】alloc.h【参见】mallocfarcallc【功能】从高端开始分配内存。
【原型】void far *farcalloc(unsigned ling nunits,unsigned ling unitsz)【位置】alloc.h【说明】为nunits数据项的每unitsz个字节分配空间。
返回指向新分配块的指针,如果没有足够的空间创建数据块,则返回NULL【参见】farmalloc,farfree,farcoreleft,malloc,callocfarcoreleft【功能】返回测出的高端未使用内存量。
【原型】unsigned long farcoreleft(void)【位置】alloc.h【说明】返回最高分配数据块和内存末端之间所剩的所有空间量(按照字节计算)。
【参见】farcalloc,farmalloc,coreleftfarfree【功能】从高端释放一个数据块。
【原型】void farfree(void far *block)【位置】alloc【参见】farmalloc,farcallocfarmalloc【功能】从高端开始分配。
turboC教案

《C语言程序开发软件win TC的使用》教学设计教学过程设计第2课时教学环节教学活动教学意图教学内容及教师活动学生活动讲授新课五、详细介绍Win TC的使用:(20分钟)1. 引入:之前是载入已写好的程序,下面我们自己动手来完成程序的编写、调试、编译、运行、保存等一整套的WinTC上机过程。
重点讲述软件参数的设置、文件的存储路径等。
以我们第一节课编写的两个C程序为例:例1:a=1,b=2,输出a+b的值sum。
例2:从键盘输入两个数,求这两个数的值并输出(复习输入函数的格式,学生独立完成)。
教师活动3:演示完整的Win TC的上机过程。
并对重难点进行讲解和强调(getch()函数使屏幕静止),代码出现错误如何改错?观察并随即指导,对典型的出错立即调控课堂,对全体同学强调。
回忆之前自己编写的程序代码。
上机完成例2,观察是否出现错误,思考并改正错误。
用实例教学法进行系统的讲解,学生练习题的安排上利于提高学生知识的灵活运用能力知识迁移与拓展六、布置学习任务,进行上机实操。
(22分钟)编写实现如下功能的C程序,并调试编译运行,最后将源文件、目标文件、可执行文件以题号为名保存在自己名字命名的文件夹中:基础任务:在屏幕输出右侧的图形(参考tuxingck.c)提高任务:将源文件year.c补充完整,使程序实现如下功能:1)程序运行时首先出现提醒文字:please input your age:2)在键盘输入年龄后,计算机立即计算出你的出生年份,并输出文字:You was borned on 年份。
#include <stdio.h>main(){int age,year;clrscr();printf("please input your age:");scanf(________________);______________________printf(__________________);getch();}教师活动4:布置并介绍任务,分发文件,演示效果。
Turbo C++ 3.0使用jh
Turbo C++ 3.0使用Turbo C++ 3.0使用 (1)1 C 简介 (7)1.1 Turbo C 是美国Borland 公司的产品 (7)1.2 1987年首次推出TurboC 1.0 (7)1.3 1988年推出Turbo C1.5 (7)1.4 1989年推出Turbo C 2.0 (7)1.5 1991年推出Turbo C++ (7)2 相关概念 (7)2.1 程序 (7)2.1.1 计算机解决问题的指令集合 (7)2.2 源程序 (7)2.2.1 高级语言编写的程序*.c (7)2.3 编译程序(系统) (7)2.3.1 翻译源程序为目标程序的程序 (7)解释型 (7)编译型 (7)2.4 目标程序 (7)2.4.1 二进制代码程序*.obj (7)2.5 可执行的目标程序 (7)2.5.1 目标程序和库函数连接后*.exe (7)2.6 集成环境IDE (7)2.6.1 编辑、编译、连接、运行操作在一个界面上进行的系统 (7)2.6.2 IDE:Integrated Environment (7)3 主菜单(10个):File Edit Search Run Compile Debug Project Options window help (7)4 菜单、窗口操作 (7)4.1 Alt+首字母:打开菜单项 (7)4.2 键入下拉菜单项的首字母即执行 (7)4.3 光标键移动光条 (7)4.4 回车键执行选择 (7)4.5 Esc:退回 (7)4.6 F1:help (7)4.7 F2:save as (7)4.9 F4:运行到光标处 (7)4.10 F5:扩大编辑窗口 (7)4.11 F6:编辑、信息窗口切换 (8)4.12 F7:跟踪 (8)4.13 F8:执行当前函数的下一条语句 (8)4.14 F9:更新 (8)4.15 F10:编辑、主菜单切换 (8)4.16 C++3.0支持鼠标 (8)5 File菜单 (8)5.1 New:新建文件 (8)5.2 Open:打开文件,热键F3。
C语言基础教程
C語言基礎教程(一)網上收集整理Turbo C語言概述1.1 C 語言的產生與發展C 語言是1972年由美國的Dennis Ritchie設計發明的, 並首次在UNIX操作系統的DEC PDP-11 電腦上使用。
它由早期的編程語言BCPL( Basic CombindProgramming Language) 發展演變而來。
在1970年, AT&T 貝爾實驗室的KenThompson根據BCPL語言設計出較先進的並取名為B的語言, 最後導了C語言的問世。
隨著微型電腦的日益普及, 出現了許多C 語言版本。
由於沒有統一的標準,使得這些 C 語言之間出現了一些不一致的地方。
為了改變這種情況, 美國國家標準研究所(ANSI)為C 語言制定了一套ANSI標準, 成為現行的C語言標準C 語言的特點C 語言發展如此迅速, 而且成為最受歡迎的語言之一, 主要因為它具有強大的功能。
許多著名的系統軟體, 如DBASE ⅢPLUS、DBASE Ⅳ都是由C 語言編寫的。
用 C 語言加上一些組合語言副程式, 就更能顯示 C 語言的優勢了, 象PC- DOS 、WORDSTAR等就是用這種方法編寫的。
歸納起來C 語言具有下列特點:1. C是中級語言它把高級語言的基本結構和語句與低級語言的實用性結合起來。
C 語言可以象組合語言一樣對位、位元組和地址進行操作, 而這三者是電腦最基本的工作單元。
2. C是結構式語言結構式語言的顯著特點是代碼及數據的分隔化, 即程式的各個部分除了必要的資訊交流外彼此獨立。
這種結構化方式可使程式層次清晰, 便於使用、維護以及調試。
C 語言是以函數形式提供給用戶的, 這些函數可方便的調用, 並具有多種循環、條件語句控制程式流向, 從而使程式完全結構化。
3. C語言功能齊全C 語言具有各種各樣的數據類型, 並引入了指針概念, 可使程式效率更高。
另外 C 語言也具有強大的圖形功能, 支持多種顯示器和驅動器。
c程序设计 第5章 选择结构程序设计
5.2
逻辑运算符和逻辑表达式
用逻辑运算符将关系表达式或逻辑量连接 起来的式子就是逻辑表达式。 ! 高 算术运算
a b !a
关系运算
a&&b
&&
真 真 真 假
逻辑 运算 真值 表
|| 低
a||b
真 真 假 假
ቤተ መጻሕፍቲ ባይዱ
真 假 真 假
假 假 真 真
真 假 假 假
例如:
(a>b) && (x>y) 可写成 a>b && x>y
Turbo c菜单介绍(Alt+首字符)
Edit (编辑)、 Compile (编译) 、 Project (工程) 、 Options (选项) 、 Debug (调试) 、 Break/Watch (中断 /查看) 、Run菜单(运行) Run Ctrl+F9 编译、连接、运行C源程序 Program reset Ctrl+F2 重新编译、连接、运行C源程 序
第5章
选择结构程序设计
重点: 如何实现程序中选择结构? 关系运算符和关系表达式 逻辑运算符和逻辑表达式 if语句和switch语句
5.1 关系运算符和关系表达式
关系运算===比较运算。结果为真或假(0或 非零)。 一、运算符与优先级 (左结合性)
< 高 高 <= 同级 > >= == != 同级 低
else if(number>100) cost=0.075;
else if(number>50) cost=0.05;
else cost=0;
例5.1 从键盘输入两个整型数,输出最大数。
开 始 main() { int a ,b ; scanf(“%d,%d”,&a,&b); if(a>b) printf(“max=%d\n”,a); if(b>a) printf(“max=%d\n”,b); } end a<b b a,b a>b a
Turbo C 2.0怎么绘图
Turbo C 2.0 下怎样绘图?初学者必看许多刚学 Turbo C 2.0(以下简称 tc)的人在做图形程序时都遇到过下面这个错误吧:BGI Error: Graphics not initialized (use 'initgraph')原因只有一个:程序找不到 BGI 图形驱动,初始化出错了。
请看我写的两种正确的调用方法:方法一,比较正宗:假设 tc 安装在c:\tc20下,要根据你的 tc 所在路径修改代码中的红色部分(路径中的反斜杠是转义符,要用 \\ 表示 \)。
#include <conio.h>#include <graphics.h>void main(){intgdriver=VGA, gmode=VGAHI;initgraph(&gdriver, &gmode, "c:\\tc20\\bgi");rectangle(100,100,300,300); /*画一个方块测试*/getch();closegraph();}方法二,比较偷懒:使用以下代码前,请将 bgi 文件夹下的 EGAVGA.BGI 拷贝一份到上级目录,就是和 tc.exe 在同一个目录内。
#include <stdio.h>#include <conio.h>#include <graphics.h>void main(){intgdriver=VGA, gmode=VGAHI;initgraph(&gdriver, &gmode, NULL);rectangle(100,100,300,300); /*画一个方块测试*/getch();closegraph();}是的,BGI 的路径写 NULL 就可以了,initgraph 会在当前路径下找的。
就算用的第一种方法,如果没有找到图形驱动,也会再找一下当前路径的。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
如何使用 Turbo C 所谓配置文件是包含Turbo C 2.0有关信息的文件, 其中存有编译、连接的选 择和路径等信息。 可以用下述方法建立Turbo C 2.0的配置: 1. 建立用户自命名的配置文件
可以从Options菜单中选择Options/Save options命令, 将当前集成开发环境 的所有配置存入一个由用户命名的配置文件中。下次启动TC时只要在DOS下键入: tc/c
就会按这个配置文件中的内容作为Turbo C 2.0的选择。 2. 若设置Options/Environment/Config auto save 为on, 则退出集成开发环
境时, 当前的设置会自动存放到Turbo C 2.0配置文件TCCONFIG.TC中。Turbo C 在 启动时会自动寻找这个配置文件。 3. 用TCINST设置Turbo C的有关配置, 并将结果存入TC.EXE中。Turbo C 在启 动时, 若没有找到配置文件, 则取TC.EXE中的缺省值。
主菜单 在Turbo C 2.0主屏幕顶上一行, 显示下列内容: File Edit Run Compile Project Options Debug Break/watch 除Edit外, 其它各项均有子菜单, 只要用Alt加上某项中第一个字母(即大写字 母), 就可进入该项的子菜单中。 一、File(文件)菜单 按Alt+F可进入File菜单, 该菜单包括以下内容: .Load(加载)
装入一个文件, 可用类似DOS的通配符(如*.C)来进行列表选择。也可装入其它 扩展名的文件, 只要给出文件名(或只给路径)即可。该项的热键为F3, 即只要在主 菜单中按F3即可进入该项, 而不需要先进入File菜单再选此项。 .Pick(选择)
将最近装入编辑窗口的8个文件列成一个表让用户选择, 选择后将该程序装入 编辑区, 并将光标置在上次修改过的地方。其热健为Alt-F3。 .New(新文件)
说明文件是新的, 缺省文件名为NONAME.C, 存盘时可改名。 .Save(存盘)
将编辑区中的文件存盘, 若文件名是NONAME.C时, 将询问是否更改文件名, 其 热键为F2。 .Write to(存盘)
可由用户给出文件名将编辑区中的文件存盘, 若该文件已存在, 则询问要不要 覆盖。 .Directory(目录)
显示目录及目录中的文件, 并可由用户选择。 .Change dir(改变目录)
显示当前目录, 用户可以改变显示的目录。 .Os shell(暂时退出)
暂时退出Turbo C 2.0到DOS提示符下, 此时可以运行DOS 命令, 若想回到 Turbo C 2.0中, 只要在DOS状态下键入EXIT即可。 .Quit(退出) 如何使用 Turbo C 退出Turbo C 2.0, 返回到DOS操作系统中, 其热键为Alt+X。 说明: 以上各项可用光标键移动色棒进行选择, 回车则执行。也可用每一项的第一个 大写字母直接选择。若要退到主菜单或从它的下一级菜单列表框退回均可用Esc键, Turbo C 2.0所有菜单均采用这种方法进行操作, 以下不再说明。
二、Edit(编辑)菜单 按Alt+E可进入编辑菜单, 若再回车, 则光标出现在编辑窗口, 此时用户可以 进行文本编辑。 编辑方法基本与wordstar相同, 可用F1键获得有关编辑方法的帮助信息。 与编辑有关的功能键如下: F1 获得Turbo C 2.0编辑命令的帮助信息 F5 扩大编辑窗口到整个屏幕 F6 在编辑窗口与信息窗口之间进行切换 F10 从编辑窗口转到主菜单 编辑命令简介: PageUp 向前翻页 PageDn 向后翻页 Home 将光标移到所在行的开始 End 将光标移到所在行的结尾 Ctrl+Y 删除光标所在的一行 Ctrl+T 删除光标所在处的一个词 Ctrl+KB 设置块开始 Ctrl+KK 设置块结尾 Ctrl+KV 块移动 Ctrl+KC 块拷贝 Ctrl+KY 块删除 Ctrl+KR 读文件 Ctrl+KW 存文件 Ctrl+KP 块文件打印 Ctrl+F1 如果光标所在处为Turbo C 2.0库函数, 则获得有关该函数的帮助 信息 Ctrl+Q[ 查找Turbo C 2.0双界符的后匹配符 Ctrl+Q] 查找Turbo C 2.0双界符的前匹配符
说明: 1. Turbo C 2.0的双界符包括以下几种符号:
花括符 {和} 尖括符 圆括符 (和) 方括符 [和] 注释符 /*和*/ 双引号 单引号 ' 如何使用 Turbo C 2. Turbo C 2.0在编辑文件时还有一种功能, 就是能够自动缩进, 即光标定位 和上一个非空字符对齐。在编辑窗口中, Ctrl+OL为自动缩进开关的控制键。 三、Run(运行)菜单 按Alt+R可进入Run菜单, 该菜单有以下各项: .Run(运行程序)
运行由Project/Project name项指定的文件名或当前编辑区的文件。如果对上 次编译后的源代码未做过修改, 则直接运行到下一个断点(没有断点则运行到结束)。 否则先进行编译、连接后才运行, 其热键为Ctrl+F9。 .Program reset(程序重启)
中止当前的调试, 释放分给程序的空间, 其热键为Ctrl+F2。 .Go to cursor(运行到光标处)
调试程序时使用, 选择该项可使程序运行到光标所在行。光标所在行必须为一 条可执行语句, 否则提示错误。其热键为F4。 .Trace into(跟踪进入)
在执行一条调用其它用户定义的子函数时, 若用Trace into项, 则执行长条将 跟踪到该子函数内部去执行, 其热键为F7。 .Step over(单步执行)
执行当前函数的下一条语句, 即使用户函数调用, 执行长条也不会跟踪进函数 内部, 其热键为F8。 .User screen(用户屏幕)
显示程序运行时在屏幕上显示的结果。其热键为Alt+F5。
四、Compile(编译)菜单 按Alt+C可进入Compile菜单, 该菜单有以下几个内容: .Compile to OBJ(编译生成目标码)
将一个C源文件编译生成.OBJ目标文件, 同时显示生成的文件名。其热键为 Alt+F9。 .Make EXE file(生成执行文件) 此命令生成一个.EXE的文件, 并显示生成的.EXE文件名。其中.EXE文件名是下 面几项之一。 1. 由Project/Project name说明的项目文件名。 2. 若没有项目文件名, 则由Primary C file说明的源文件。 3. 若以上两项都没有文件名, 则为当前窗口的文件名。 .Link EXE file(连接生成执行文件) 把当前.OBJ文件及库文件连接在一起生成.EXE文件。 .Build all(建立所有文件)
重新编译项目里的所有文件, 并进行装配生成.EXE文件。该命令不作过时检查 (上面的几条命令要作过时检查, 即如果目前项目里源文件的日期和时间与目标文 件相同或更早, 则拒绝对源文件进行编译)。 .Primary C file(主C文件)
当在该项中指定了主文件后, 在以后的编译中, 如没有项目文件名则编译此项 中规定的主C文件, 如果编译中有错误, 则将此文件调入编辑窗口, 不管目前窗口 中是不是主C文件。 .Get info(获得有关当前路径、源文件名、源文件字节大小、编译中的错误数 如何使用 Turbo C 目、可用空间等信息。 五、Project(项目)菜单 按Alt+P可进入Project菜单, 该菜单包括以下内容: .Project name(项目名)
项目名具有.PRJ的扩展名, 其中包括将要编译、连接的文件名。例如有一个程 序由file1.c, file2.c, file3.c组成, 要将这3个文件编译装配成一个file.exe的 执行文件, 可以先建立一个file.prj的项目文件, 其内容如下: file1.c file2.c file3.c 此时将file.prj放入Project name项中, 以后进行编译时将自动对项目文件中 规定的三个源文件分别进行编译。然后连接成file.exe文件。 如果其中有些文件已经编译成.OBJ文件, 而又没有修改过, 可直接写上.OBJ扩 展名。此时将不再编译而只进行连接。 例如: file1.obj file2.c file3.c 将不对file1.c进行编译, 而直接连接。 说明:
当项目文件中的每个文件无扩展名时, 均按源文件对待, 另外, 其中的文件也 可以是库文件, 但必须写上扩展名.LIB。 .Break make on(中止编译) 由用户选择是否在有Warining(警告)、Errors(错误)、Fatal Errors( 致命错 误)时或Link(连接)之前退出Make编译。 .Auto dependencies(自动依赖)
当开关置为on, 编译时将检查源文件与对应的.OBJ文件日期和时间, 否则不进 行检查。 .Clear project(清除项目文件)
清除Project/Project name中的项目文件名。 .Remove messages(删除信息)
把错误信息从信息窗口中清除掉。 六、Options(选择菜单) 按Alt+O可进入Options菜单, 该菜单对初学者来说要谨慎使用。 .Compiler(编译器)
本项选择又有许多子菜单, 可以让用户选择硬件配置、存储模型、调试技术、 代码优化、对话信息控制和宏定义。这些子菜单如下: Model 共有Tiny, small, medium, compact, large, huge 六种不同模式可由同户选 择。 Define 打开一个宏定义框, 同户可输入宏定义。多重定义可同分号, 赋值可用等号。 Code generation 它又有许多任选项, 这些任选项告诉编译器产生什么样的目标代码。