Introduction to Computer and Programing Thanachat Thanomkulabut
Outline 2 Introduction to computer Programming Languages C# Language Overview
Definition of Computer 3 Devices for performing computations at high speeds with great accuracy A machine that can be programmed to manipulate symbols Can quickly store and retrieve large amounts of data. Physical components are known as “Hardware” Introduction to computer
Computer Categories 4 Desktop Computer Labtop PDA – Personal Digital Assistant Personal Computer High Computation Power Supercomputer Mainframe Introduction to computer
Computer Systems Hardware Actual physical machines (equipment) that make up the computer 5 Software Programs written for a specific application are often called softwares Introduction to computer
Computer Components CPU (Central Processing Unit) Primary storage (memory) Secondary storage (disks, tapes, etc.) Input devices (mouse, keyboard, etc.) Output devices (screen, printer, etc.) 6 Introduction to computer
Hardware - Process INPUT Processing Primary storage OUTPUT command Information result Secondary storage Introduction to computer
Computer Storage Primary Storage RAMROM Secondary Storage 8 Much Faster More expensive Slower Less expensive Can Read/Write Volatile Read Only Non - Volatile Introduction to computer
Data Representation 9 Data in computer is represented in “ bit ” bit = binary digit 0 or 1 Byte = 8 bits 1 byte can represent many kinds of data 1 byte = the above 1 byte means, “a” or 97 the meaning of 1 byte depends on the program 1 Kbyte = 2 10 = 1024 bytes 1 Mbyte = 2 20 = 1,048,576 bytes 1 Gbyte = 2 30 = 1,073,741,824 bytes 1 Tbyte = 2 40 = 1,099,511,627,776 bytes Introduction to computer
Outline 10 Introduction to computer Programming Languages C# Language Overview
Programming Languages 11 Program A set of instructions for a computer to follow, written in specific programming language Types of programming language High-Level Language Assembly Language Machine Language Programming Languages
High-level VS Assembly VS Machine Language 12 High-level Language Nearly like human word SUM := A * 2 + ALPHA/3; Assembly Language Some key words are understandable MULL3A, #2, R ADDL3R6, R7, SUM Machine Language Only “ 0 ” and “ 1 ” Computer itself understands only Machine language
Language translator 13 Interpreter / Compiler Hello World! _ High-level language static void Main( ) { Console.WriteLine("Hello World!"); } Assembly language pushl %ebp movl %esp, %ebp subl $8, %esp andl $-16, %esp Machine language Assembler Machine Programming Languages
High-Level Languages Procedural Language Fortran Cobol Basic C Pascal Object-Oriented Language C++ Java C# Functional Language Lisp Logic Language Prolog 14 Programming Languages
Outline 15 Introduction to computer Programming Languages C# Language Overview
A simple C# Program 16 Grouping using { } C# Language Overview
A simple C# Program 17 Statement ending with semicolon “;” C# Language Overview
A simple C# Program 18 C# syntax is case-sensitive namespaceNAMEspace Main()main() C# Language Overview
A simple C# Program 19 White space means nothing static void Main(string[] args) { Console.WriteLine("Hello World!"); } static void Main(string[] args){ Console.WriteLine("Hello World!");} C# Language Overview
A simple C# Program 20 Anything between /* */ or after // is considered a comment static void Main(string[] args) //comment here { /* This is comment too. */ Console.WriteLine("Hello World!"); } Comments will not be translated C# Language Overview
Program Structure The starting point of the program is: This is known as the method Main A method is put inside a class A class may be put inside a namespace static void Main () {... starting point... } static void Main () {... starting point... } 21 C# Language Overview
Program Structure In C# A program can contain several namespaces A namespace can contain several classes A class can contain several methods In other words Think of a namespace as a container of classes Think of a class as a container of methods method1 method2 namespace Class Class 22 C# Language Overview
Program Structure For this course Program with only one class and at most one namespace For now until sometime before midterm Program with one method (i.e., Main) namespace HelloW { class HelloWClass { static void Main () { System.Console.WriteLine("Hello World!"); System.Console.ReadLine(); } namespace HelloW { class HelloWClass { static void Main () { System.Console.WriteLine("Hello World!"); System.Console.ReadLine(); } 23 C# Language Overview
Naming Rules Letters, digits and underscores(_) First character letter or _ Up to 63 characters long Must not be a reserved word * Case Sensitive Example KU67 ≠ kU67 ≠ku67 KU67 ≠ kU67 ≠ ku67 C# Language Overview 24
Naming Rules Letters, digits and underscores(_) First character letter or _ Up to 63 characters long Must not be a reserved word C# Language Overview 25 Example nameName _data 9point class class_A class_”A” point9
C# Reserved Words C# Language Overview 26
Any question?