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");
	
	
}


posted @ 2017-04-19 09:45  gccbuaa  阅读(189)  评论(0编辑  收藏  举报