Visual C++ introduction Auditor : Yu-Che Lin Adviser : Prof. Jian-Jiun Ding Nov. 8 2007 Digital image and signal processing Lab. Institute of Communication Engineering, National Taiwan University Taipei, Taiwan, R.O.C.
main 函數 ; header 檔 傳回值型態 main (引入參數) { ….. return 傳回值; } Digital image and signal processing Lab. Institute of Communication Engineering, National Taiwan University Taipei, Taiwan, R.O.C.
變數宣告 int x(=數字); float y(=數字); double w(=數字); char z(=‘字元’); Digital image and signal processing Lab. Institute of Communication Engineering, National Taiwan University Taipei, Taiwan, R.O.C.
字串 char s[7] ; // 宣告變數S含有7個位元長度 Char s[7] = “Hello!”; 結束位元 : \0 Digital image and signal processing Lab. Institute of Communication Engineering, National Taiwan University Taipei, Taiwan, R.O.C.
算數運算子;比較運算子;邏輯運算子 算數運算子:(1) 比較運算子:(2) 邏輯運算子:(3) 算數指定運算子: (由右到左) + , - , * , / , % 算數指定運算子: (由右到左) += , -= , *= , /= Ex: int A=2 , B = 5 ; B += A *= 3; A = 6 , B = 11 比較運算子:(2) == , > , < , >= , <= , != 邏輯運算子:(3) &&(優先) , || , ! Digital image and signal processing Lab. Institute of Communication Engineering, National Taiwan University Taipei, Taiwan, R.O.C.
i++ / ++i Digital image and signal processing Lab. Institute of Communication Engineering, National Taiwan University Taipei, Taiwan, R.O.C.
for 迴圈 for (initial value ; condition ; counting) { } ex: Statements; int i,sum=0; for (i=0; i<=100; i++){ sum = sum + i; Digital image and signal processing Lab. Institute of Communication Engineering, National Taiwan University Taipei, Taiwan, R.O.C.
Digital image and signal processing Lab. Institute of Communication Engineering, National Taiwan University Taipei, Taiwan, R.O.C.
Digital image and signal processing Lab. Institute of Communication Engineering, National Taiwan University Taipei, Taiwan, R.O.C.
if..else if / switch..case if (condition1){ switch(condition factor){ Statements; } case condition1: else if (condition2){ Statements; Statements; break; } case condition2: ….. Statements; else{ break; Statements; ….. } default: statements; } Digital image and signal processing Lab. Institute of Communication Engineering, National Taiwan University Taipei, Taiwan, R.O.C.