例1:
/*Example program of Turbo C*/
#include <stdio.h> /*包含文件说明*/
void lgc(void); /*子函数说明*/
char answer; /*定义全程变量*/
int main(){ /*主函数定义*/
char a; /*定义局部变量*/
clrscr();
gotoxy(12,3);
puts("Welcome to use Turbo C2.0!");
gotoxy(15, 13);
printf("<Esc>--Exit");
gotoxy(15, 15);
printf("<CR>--Continue");
while(1){
a=getch();
if(a==27)
break;
if(a==13) {
lgc();
if(answer=='y'||answer=='Y') {
gotoxy(23,14);
puts("Please Write to the Company");
getch();
break;
}
}
}
return(0);
}
void lgc(void) {
clrscr();
gotoxy(12,8);
printf("The Excellent Selection!");
gotoxy(21,12);
printf("Do you have any question?(Y/N)");
answer=getche();
}
《C语言宝典》学习笔记(一):一段Turbo C源程序
本文是《C语言宝典》的学习笔记第一部分,主要介绍了如何使用Turbo C2.0编写并运行一个简单的源程序。程序中包含了基本的输入输出操作,以及通过用户交互来决定程序流程的实现。通过对主函数和子函数的理解,读者可以掌握C语言的基本结构和控制流程。

被折叠的 条评论
为什么被折叠?



