#include#include #include //system(); 這個指令需要用到此頭文件 #include //toupper要用到 #include //在內存管理時用到的頭文件 void main() { char letter; // Letter typed by the user printf("Do you want to continue? (Y/N): "); letter = _getch(); // Get the letter letter = toupper(letter); // Convert letter to uppercase while ((letter != 'Y') && (letter != 'N')) { _putch(7); // Beep the speaker letter = _getch(); // Get the letter letter = toupper(letter); // Convert letter to uppercase } printf("\nYour response was %c\n", letter); system("pause"); }