例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();
}