首页 > 代码库 > C经典之9-system,if,do,while---ShinePans

C经典之9-system,if,do,while---ShinePans



#include <stdio.h>
#include <conio.h>
#include <stdlib.h>  //system(); 这个指令需要用到此头文件
#include <ctype.h> //toupper要用到
void main()
{
	char letter;
	do{
		printf("A Display directory listling\n");
		printf("B Display disk information\n");
		printf("C Change system date\n");
		printf("Q Exit\n");
		printf("Choice: ");
		letter = _getch();
		letter = toupper(letter);
		if (letter == ‘A‘)
			system("DIR");
		else if (letter == ‘B‘)
			system("CHKDSK");
		else if (letter == ‘C‘)
			system("DATE");
	} while (letter != ‘Q‘);
	system("pause");
	
	
}