// C5_4.cpp : Defines the entry point for the console application. // 陣列中的字串 #include "stdafx.h" #include using namespace std; int main(int argc, char* argv[]) { char TeaTime[6][60] = { "精緻小蛋糕 - Cake ", "貝果 - Bagel ", "可頌 - Croissant ", "丹麥酥 - Danish ", "瑪芬 - Muffin ", "英式鬆餅 - Scone " }; int Choice = 0; cout << endl << " 請選擇點心 ! " << " 請鍵入數字 1 至 6 : "; cin >> Choice; if(Choice >= 1 && Choice <= 6) // 檢查輸入值 cout << endl // 輸出字串 << "您選擇的點心為 : " << TeaTime[Choice-1]; else cout << endl // 無效輸入 << "輸入值不在範圍內,請重新執行。"; cout << endl; return 0; }