Sharp Develop 3 0 download http www icsharpcode Slides: 41 Download presentation ตดตง Sharp Develop 3. 0 หรอ download ไดท http: //www. icsharpcode. net/Open. Source/SD/Download/ New Project Dialog สวนประกอบของหนาจอโปรแกรม Menu bar Toolbar Solution Explorer Toolbox Windows Form Designer Properties Window โครงสรางของโปรแกรม C# ������ Class <Identifier> {……. } namespace Hello. W { class Hello. WClass { static void Main () { System. Console. Write. Line("Hello World!"); System. Console. Read. Line(); } } } method Main method จะตองอยใน class จะตองอยใน class namespace โครงสรางของโปรแกรม C# Your Namespace Name Your Class Name Your declaration part Your statements 13 C# Overvie โครงสรางของโปรแกรม C# namespace Hello. W { class Hello. WClass { static void Main () { System. Console. Write. Line("Hello World!"); System. Console. Read. Line(); } } } โปรแกรมจะตองประกอบดวยอยางนอย Namespace 1 พจารณาชอตวแปรตอไปนวาถกตองตามกฎการ ตงชอหรอไม _Y Null String 204111 Class i_j Section 3 Student ID s. ECTION 3 Hello. World!! w*h first-time do คำสงแสดงผล ���� 1 Console. Write (������� ); ���� 2 Console. Write. Line (������� ); Console. Write ("Hello"); Console. Write. Line ("Hello World"); string str = "Hello"; Console. Write (str + " World"); 22 คำสงรบขอมล ���� 1 Console. Read (); ���� Console. Read. Line (); ���� 2 ������ = Console. Read (); ������ = Console. Read. Line (); Console. Write ("What is your name? : "); string name = Console. Read. Line ( ); // Laksamee Console. Write ("My name is " + name); Console. Read ( ); 24 เลขจำนวนเตม Data type ขนาด คาของขอมล sbyte) System. SByte) 1 byte 128 -ถง 127 short) System. Int 16) 2 bytes 32, 768 -ถง 32, 767 int) System. Int 32) 4 bytes 2, 147, 483, 648 -ถง 2, 147, 483, 647 long (System. Int 64) 27 8 bytes -263 ��� (263 – 1) เลขจำนวนเตมบวก Data type ขนาด คาของขอมล byte) System. Byte) 1 byte 0ถง 255 ushort) System. UInt 16) 2 bytes 0ถง 65, 535 uint) System. UInt 32) 4 bytes 0ถง 4, 294, 967, 295 ulong (System. UInt 64) 8 bytes 0ถง 264 -1 28 นพจนทางคณตศาสตร 35 Operators +-* / % (remainder after division) Example 11 + 5 16 11 / 2 5. 5 11 % 2 1 5. 0 % 2. 2 0. 6 (operator) ลำดบความสำคญของ 1. 2. 3. 4. ( ) parentheses *, / , % +– If equal precedence, left to right ตวอยาง int Width, High; Width=10*5+16*12/5; High= 16+5+20%2; 37 Operators