1. Turbo C程序的一般組成部分
Turbo C 2.0 象其它語言一樣按其規(guī)定的格式和提供的語句由用戶編寫應(yīng)用程
序。 請看下面一段Turbo C源程序。 例1:
/*Example program of Turbo C*/
#include /*包含文件說明*/
void lgc(void);/*子函數(shù)說明*/
char answer;/*定義全程變量*/
int main()/*主函數(shù)定義*/
{
char a;/*定義局部變量*/
clrscr();
gotoxy(12,3);
puts("Welcome to use Turbo C2.0!");
gotoxy(15,13);
printf("--Exit");
gotoxy(15,15);
printf("--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();}
Turbo C 2.0 象其它語言一樣按其規(guī)定的格式和提供的語句由用戶編寫應(yīng)用程
序。 請看下面一段Turbo C源程序。 例1:
/*Example program of Turbo C*/
#include /*包含文件說明*/
void lgc(void);/*子函數(shù)說明*/
char answer;/*定義全程變量*/
int main()/*主函數(shù)定義*/
{
char a;/*定義局部變量*/
clrscr();
gotoxy(12,3);
puts("Welcome to use Turbo C2.0!");
gotoxy(15,13);
printf("--Exit");
gotoxy(15,15);
printf("--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();}