#include "stdlib.h"
#include "dos.h"
#include "windows.h"
char choice1;
void main()
{
void menue1();
printf("歡迎進入Ben的作業查詢系統!");
menue1();
}
void menue1()
{
void choicemenue1();
printf("\n請按照以下列表選擇您想要查看的章節:");
printf("\n編號\t章節\n 1\t第壹章\n 2\t第二章\n");
printf("請輸入編號進行選擇:");
choicemenue1();
}
void choicemenue1()
{
choice1=getch();
switch(choice1)
{
void menuechapter1();
void menuechapter2();
void menue1();
case '1':menuechapter1();break;
case '2':menuechapter2();break;
default:printf("\n輸入錯誤!請重新選擇!\n"),menue1();
}}
void menuechapter1()
{
char choiceex;
printf("\n您選擇的是第%c章",choice1);
printf("\n現在請選擇本章節的題目。");
printf("\n請按照以下列表選擇題目:");
printf("\n編號\t題目編號\n1\t第1題\n2\t第2題\n");
printf("請選擇:");
switch(choiceex=getch())
{
void c1_1();
void c1_2();
case '1':c1_1();break;
case '2':c1_2();break;
default:
printf("\n妳個白癡!這也能選錯!不讓妳重選了!");
printf("\n按任意鍵以退出!");
getch();
exit(0);
}
}
void menuechapter2()
{
char choiceex;
printf("\n您選擇的是第%c章",choice1);
printf("\n現在請選擇本章節的題目。");
printf("\n請按照以下列表選擇題目:");
printf("\n編號\t題目編號\n1\t第1題\n2\t第2題\n");
printf("\n請選擇:");
switch(choiceex=getch())
{
void c2_1();
void c2_2();
case '1':c2_1();break;
case '2':c2_2();break;
default:
printf("\n妳個白癡!這也能選錯!不讓妳重選了!");
printf("\n按任意鍵以退出!");
getch();
exit(0);
}
}
void c1_1()
{
char howtorun;
printf("現在請選擇考察方式:");
printf("\n編號\t考察方式\n 1\t運行程序\n 2\t查看源代碼\n 3\t返回主菜單\n 4\t退出程序\n");
printf("請選擇:");
switch(howtorun=getch())
{
void runc1_1();
void menue1();
case '1':runc1_1();break;
case '2':printf("\n"),system("type \\caidan\\chapter1\\c1_1.c"),printf("\n"),getch();break;
case '3':menue1();break;
case '4':exit(0);break;
default:
printf("程序即將結束!哈哈哈……");
printf("按任意鍵以結束程序!");
getch();
exit(0);
}}
void c1_2()
{
printf("c1_2 is OK!");
}void c2_1()
{
printf("c2_1 is OK!");
}void c2_2()
{
printf("c2_2 is OK!");
}
void runc1_1()
{
int a,b,max;
printf("\nPlease input two integer numbers:");
printf("a=?,b=?\n");
scanf("%d,%d",&a,&b);
max=a>b?a:b;
printf("The max number is %d",max);
}
大概就是這樣做的。。