Upload
dwayne-conley
View
221
Download
3
Embed Size (px)
Citation preview
CIS 3260
Introduction toProgramming
Using C#
2 TAG ▪ 2010
Tom Gregory
• Center for Process Innovation• Soccer Referee• Boy Scout leader• B.S. Computer Science• MBA• Developer
USSF Grade 16
heh
3 TAG ▪ 2010
Tom GregoryCompiled Languages
Interpreted (Scripting)Languages
Special PurposeLanguages
C/C++JavaC#
(VB)
Object PascalAssembly
PHPRubyJavascriptFlash ActionscriptCold FusionBashVB/VBAScheme (Lisp)BASIC
SQLHTML, XML, XSLTCSS
4 TAG ▪ 2010
Introductions
• Name (Preferred name & last name)• Major• Programming experience• Something interesting• Anything else
TAG ▪ 20105
Syllabus Review
6 TAG ▪ 2010
GIYF
7 TAG ▪ 2010
Semester map
8 TAG ▪ 2010
My goals
• Get you to think like a programmer• Help you learn more• Make it as easy/fun as possible
Teach more,
But make it easier.
9 TAG ▪ 2010
Looking ahead (today)
• Short history of computers/programming• Bits, bytes• Hexadecimal• Types of languages• Color (RGB & HSV)
10 TAG ▪ 2010
Words to know
• Binary• Bit• Byte• Hexadecimal• Complied language• Interpreted language• RGB, CMYK• HSV (HSB): Hue, Saturation, Value/Brightness
This is easy!
11 TAG ▪ 2010
0 1 1 0 1 0 0 1
Byte
Bit
12 TAG ▪ 2010
Second-grade math
1 3 3 7
1,337
(1 x 103) + (3 x 102) + (3 x 101) + (7 x 100)
13 TAG ▪ 2010
Binary
1 3 3 7
1,337
(1 x 103) + (3 x 102) + (3 x 101) + (7 x 100)
1 1 0 1
1101
(1 x 23) + (1 x 22) + (0 x 21) + (1 x 20)
14 TAG ▪ 2010
1 3 3 7
1,337
1000 100 10 1
1 1 0 1
1011
8 4 2 1
= 13
15 TAG ▪ 2010
Practice
Convert from binary to decimal:
1111
0011
0111
0110
1110
=
=
=
=
=
15
3
7
6
14
16 TAG ▪ 2010
Hexadecimal
1 3 3 7
1,337
(1 x 103) + (3 x 102) + (3 x 101) + (7 x 100)
8 B 2 F
0x8B2F
(8 x 163) + (11 x 162) + (2 x 161) + (15 x 160)
17 TAG ▪ 2010
1 3 3 7
1,337
1000 100 10 1
8 B 2 F
0x8B2F
4096 256 16 1
= 35,631
18 TAG ▪ 2010
Practice
Convert from binary to hex:
1001
0011
1010
1110
0111
=
=
=
=
=
0x9
0x3
0xA
0xE
0x7
19 TAG ▪ 2010
Practice
Convert from hex to decimal:
0x0C
0x2F
0xFF
0xFB
=
=
=
=
12
47
255
251
20 TAG ▪ 2010
Practice
Identify most-significant bit:
0x0C
0x80
0x90
0xB8
0
1
0
1
TAG ▪ 201021
Do it in C#
22 TAG ▪ 2010
…
48 00000000 456E7465722061206E-
49 00000009 756D6265723A2000
50 00000011 456E74657220616E6F-
51 0000001A 74686572206E756D62-
52 00000023 65723A2000
…
prompt1 db "Enter a number: ", 0
prompt2 db "Enter another number: ”, 0
23 TAG ▪ 2010
44 ... 45 call read_int ; read integer46 mov eax, prompt1 ; store into input147 48 mov eax, prompt2 ; print out prompt49 call print_string50 51 call read_int ; read integer52 mov [input2], eax ; store into input253 54 mov eax, [input1] ; eax = dword at input155 addeax, [input2] ; eax += dword at input256 mov ebx, eax ; ebx = eax57 58 dump_regs 1 ; print out register values59 dump_mem 2, outmsg1, 1 ; print out memory
24 TAG ▪ 2010
Types of programming languages
Compiled Interpreted
Statically typed Dynamically typed
25 TAG ▪ 2010
Color
RGB
CMYK
26 TAG ▪ 2010
Red
GreenBlue
Cyan
Magenta Yellow
27 TAG ▪ 2010
Hue: 0 - 360°Saturation: 0 - 100%Value (Brightness): 0 – 100%
TAG ▪ 201028
Estimate RGB values:
Convert from HSV• 90°, 50%, 50%
• 120°, 0%, 100%
• 30°, 75%, 50%
(85, 105, 53)
(255, 255, 255)
(99, 63, 29)
Predict color &