untitled

Similar documents
untitled

untitled

untitled

untitled

PowerPoint 簡報

untitled

untitled

了 立 連 立 量 領 來 例 蘭 便 不 數 不 論 更 更 更 力 更 參 例 來 例 見 量 度 量 量 參 論 量 行 量 量 瑩 理 來 錄 量 量 不 力 省 力 立 力 量 量 量 了 量 便 錄 錄 錄 料 說 省 6

untitled

I/O Files讀寫檔案:

untitled

臺灣地區的警察教育現況與展望

untitled

Microsoft Word - 01.DOC

untitled

1

個人教室 / 網路硬碟

untitled

untitled

第五章 鄉鎮圖書館閱讀推廣活動之分析

untitled

中華人民共和國殘疾人保障法(2008年修訂)

國立陽明大學輻射防護計畫書

untitled

untitled

untitled

微處理機實習期末專題

untitled

untitled

untitled

人身保險業務員資格測驗方案

untitled

九十三年第三期檔案管理工作研習營學員建議事項答覆情形彙整表

第三章 我國非營業特種基金制度及運作現況

台灣經濟新報資料庫

94年度學習障礙補救教學進階研習

自學進修學力鑑定考試職業證照與專科學校類科及筆試科目對照表

廉 樂 不 廉 倫 理 廉 倫 理 領 不 參 領 不 若 不 不 不 不 利 聯 行 李 聯 例 律

依據教育部八十九年 月 日臺(八九)技(二)字第 號函

untitled

untitled

untitled

「UPENN牙醫學院見習及費城文藝之旅」成果報告書

untitled

大陸黨報集團化發展之研究

第五章 實例個案

新版 明解C++入門編

untitled

untitled

四湖鄉志纂修

untitled

untitled

untitled

CC213

untitled

untitled

untitled

untitled

專 題 論 述

行政院國科會九十一年度專題研究

untitled

untitled

untitled

2011台灣高中職專題暨小論文競賽

龍華科技大學

第一章 簡介

STANDARD

十四、特殊需求的嬰兒

untitled

地方公共服務績效比較評量之探討—標竿學習策略的觀點

untitled

untitled

說 列 流 不 不 理 料 理 路 數 錄 路 料 料 錄 路 列 來 料 便 利 行 狀 路 II

隱形眼鏡的世界

吃寒天真的能減肥嗎

untitled

untitled

untitled

untitled

PowerPoint 簡報

untitled

嘉義市都市計畫保護區農業區土地使用審查要點(草案)

untitled

untitled

untitled

untitled

untitled

untitled

untitled

4-04 論文封面(樣式)

untitled

untitled

untitled

血管內裝置感染管制作業規範

untitled

untitled

untitled

untitled


untitled

Transcription:

1

Outline 數 料 數 數 列 亂數 練

數 數 數 來 數 數 來 數 料 利 料 來

數 A-Z a-z _ () 不 數 0-9 數 不 數 SCHOOL School school 數 讀 school_name schoolname 易 不 C# my name 7_eleven B&Q new

C# (1) public protected private params override out operator object null new namespace long lock is internal interface int in implicit if goto foreach for float fixed finally false extern explicit event enum else double do delegate default decimal continue const class checked char catch case byte break bool base as abstract

C# (2) readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while

Outline 數 料 數 數 列 亂數 練

料 數 數 數 林 列 參 串 列 類

數 sbyte byte short ushort int uint long ulong 8 8 16 16 32 32 64 64 數 -128 ~ 127 0 ~ 255-32768 ~ 32767 0 ~ 65535-2147483648 ~ 2147483647 0 ~ 4294967295-9223372036854775808 ~9223372036854775807 0 ~ 18446744073709551615

數 數 來 數 數 精 度 數 float 32 7 1.5 10-45 ~ 3.4 10 38 double 64 15~16 5.0 10-324 ~ 1.7 10 308 float 數 數 f decimal 理 數 28 數 金 林 bool 林 true false

串 char 來 料 來 例 'A' 'a' '1' '2' 串 string 來 串 串 料 串 來 例 "my name is ives!!"

Outline 數 料 數 數 列 亂數 練

數 數 了 留 來 料 料 數 ; int telnum; int telnum = 321; string myname; string myname = ives ; string myname = ; int i = 16, j, k;

例 sample1-a1 行列 "XXX!!" 行列 " XXX!! " 說 static void Main(string[] args) { Console.Write(""); } string username = Console.ReadLine(); Console.WriteLine(userName + "!!"); Console.WriteLine(" " + username + "!!" ); Console.ReadLine();

練 sample1-b1 行 行 行 列 "XXX!! 行 列 " XXX X!! " 念 串 數

Outline 數 料 數 數 列 亂數 練

數 (implicity) 數 數 例 int a = 321; long b = a; (explicity) 料 例 long a = 123; int b = (int) a;

串數 數 串 利 ToString() 來 例 int a = 321; string b = a.tostring(); 串 數 利 數 Parse() 來 例 string b = "321"; int a = int.parse(b);

例 sample1-a2 (1) 串數 料 說 說 // 料 float a = 3.14f; double b = 3.9; Console.Write(" : "); Console.Write("a = " + a); Console.WriteLine(", b = "+ b); Console.Write(" : "); Console.Write("a = " + (int)a); Console.WriteLine(", b = " + (int)b);

例 sample1-a2 (2) 說 // 串數 Console.Write(" 數 :"); string c = Console.ReadLine(); Console.WriteLine(c + " 1 " + (int.parse(c) + 1).ToString()); Console.ReadLine();

練 sample1-b2 練 數 數 數 數 列 來 念 讀 料 數 理 串

Outline 數 料 數 數 列 亂數 練

行 數 + - * / 例 i = j + k; i = j - k; i = j * k; i = j / k; % 串 串 int i = 16, j, k; j = i / 3; // j 5 k = i % 3; // k 1 i = j % k;

練 sample1-b3 列 行 ( 數 ) 列 念 Console.ReadLine() 讀 來 料 串 數

(1) 串 數 (true) (false) ==!= > < >= <= 不 例 i == j i!= j i > j i < j i >= j i <= j

(2) 4 > 3 // true 'a' > 'b' // false Unicode 來 a Unicode 97 b Unicode 98 b a

例 sample1-a3 數 列 數 說 // 數 Console.Write(" 數 :"); int i = int.parse(console.readline()); Console.Write(" 數 :"); int j = int.parse(console.readline()); // 列 Console.WriteLine(i + " == " + j + " " + (i==j)); Console.WriteLine(i + "!= " + j + " " + (i!=j)); Console.WriteLine(i + " > " + j + " " + (i>j)); Console.WriteLine(i + " < " + j + " " + (i<j)); Console.WriteLine(i + " >= " + j + " " + (i>=j)); Console.WriteLine(i + " <= " + j + " " + (i<=j));

練 sample1-b4 數 數 5 5 列 true 列 false 念 利 > <=

來 例 && i && j i j i j 若 i j!!i 若 i 若 i (4>3) && ('a'=='b') //(true) && (false) false (4>3) ('a'=='b') //(true) (false) true! (4>3) //!(true) false

(=) 來 來 例 來 = i = 5 i = 5 += i += 5 i = i + 5 -= i -= 5 i = i - 5 *= i *= 5 i = i * 5 /= i /= 5 i = i / 5 %= i %= 5 i = i % 5

練 sample1-b5 ( 數 ) 列 念 利

來 數 數 數 ++ 數 例 i++ ++i -- 數 int a = 5, b = 5; int c = a++; //c 5 int d = ++b; //d 6 i-- --i

例 sample1-a4 說 說 int i=10, j=0, x=10, y=0; j += ++i; Console.WriteLine("i ="+ i +", j = " + j); y += x++; Console.WriteLine("x =" + x +", y = " + y); Console.WriteLine("x =" + x++); Console.WriteLine("x =" + x);

a + b + c 行 a + b c a + b * c 行 b * c a (a + b) * c 行 a + b c a = b = c c b b a

Outline 數 料 數 數 列 亂數 練

數 數 數 來 料 不 數 數 const double pi = 3.1415926;

練 sample1-b6 ( 數 ) 列 念 數 pi = 3.1415926 * * pi

Outline 數 料 數 數 列 亂數 練

列 列 來 ( 數 ) 列 int byte sbyte short ushort uint long ulong 列, 列 不 enum language:long { English = 0, Chinese = 1 }

例 sample1-a5 列 錄 說 enum studentid:int { alice = 12, bob = 24 } static void Main(string[] args) { Console.WriteLine(studentID.alice + " : " + (int)studentid.alice); Console.WriteLine(studentID.bob + " : " + (int)studentid.bob); Console.ReadLine(); }

練 sample1-b7 列 念 利 列 數 錄 來 Sun = 1, Mon = 2, Tue = 3, Wed = 4, Thi = 5, Fri = 6, Sat = 7

Outline 數 料 數 數 列 亂數 練

料 來 不 不 struct student { public int id; public string name; }

例 sample1-a6 利 struct 立 student 料 說 struct student { public int id; public string name; } static void Main(string[] args) { student ives; ives.id = 27; ives.name = "ives"; } Console.WriteLine(": " + ives.name + "\n" + ": " + ives.id );

練 sample1-b8 利 錄 料 列 行 年 列 料 念 利 struct 立 name age tel 料欄

Outline 數 料 數 數 列 亂數 練

亂數 亂數 來 數 亂數 Random 數 = new Random(); 亂數 數.Next(, ) 亂數

例 sample1-a7 列 1 ~ 9 亂數 說 // 亂數 Random rnd = new Random(); // 亂數 Console.WriteLine(rnd.Next(1,10)); Console.WriteLine(rnd.Next(1,10)); Console.WriteLine(rnd.Next(1,10));

練 sample1-b9 亂數 1 ~ 3 數 數 列 ture false 念 利 Random Next

Outline 數 料 數 數 列 亂數 練

練 hw2 (1) Bob Alice 利 數 列 Bob Alice 了 利 struct 錄 Bob Alice 列 Bob Alice 列 Bob 句

練 hw2 (2) 行