// C4_6.cpp : Defines the entry point for the console application. // do- while 迴圈指令 #include "stdafx.h" #include using namespace std; int main(int argc, char* argv[]) { char status = 'n'; // 宣告變數 long data = 0; cout << "公里與英哩(miles)轉換 -- 1 公里 = 0.62136英哩: " << endl ; do // do-while 迴圈開始 { cout << endl << "請輸入一整數值 : "; cin >> data; cout << data << "公里 " << " = " << data * 0.62136 << "英哩" ; cout << endl << "是否要輸入其他數值 (y or n)? "; cin >> status; } while((status=='y') || (status=='Y')); return 0; }