// C4_3.cpp : Defines the entry point for the console application. // for 迴圈應用 -- 利用二變數計數(顯示英文字母的 ASCII 碼) #include "stdafx.h" #include #include using namespace std; // main() 函式 int main(int argc, char* argv[]) { cout << setw(10) << "字母"; cout << setw(10) << "16進位"; cout << setw(10) << "10進位"; for(char Large='A', little='a'; Large<='Z'; Large++, little++) cout << endl << "\t" << Large // 輸出 Large 變數 << hex << setw(10) << static_cast(Large) // 輸出 Large 變數(16 進位) << dec << setw(10) << static_cast(Large) // 輸出 Large 變數(10 進位) << " " << little // 輸出 little 變數 << hex << setw(10) << static_cast(little) // 輸出 little 變數(16 進位) << dec << setw(10) << static_cast(little); // 輸出 little 變數(10 進位) cout << endl; return 0; }