28
CIS 3260 Introduction to Programming Using C#

CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

Embed Size (px)

Citation preview

Page 1: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

CIS 3260

Introduction toProgramming

Using C#

Page 2: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

2 TAG ▪ 2010

Tom Gregory

• Center for Process Innovation• Soccer Referee• Boy Scout leader• B.S. Computer Science• MBA• Developer

USSF Grade 16

heh

Page 3: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

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

Page 4: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

4 TAG ▪ 2010

Introductions

• Name (Preferred name & last name)• Major• Programming experience• Something interesting• Anything else

Page 5: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

TAG ▪ 20105

Syllabus Review

Page 6: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

6 TAG ▪ 2010

GIYF

Page 7: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

7 TAG ▪ 2010

Semester map

Page 8: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

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.

Page 9: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

9 TAG ▪ 2010

Looking ahead (today)

• Short history of computers/programming• Bits, bytes• Hexadecimal• Types of languages• Color (RGB & HSV)

Page 10: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

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!

Page 11: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

11 TAG ▪ 2010

0 1 1 0 1 0 0 1

Byte

Bit

Page 12: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

12 TAG ▪ 2010

Second-grade math

1 3 3 7

1,337

(1 x 103) + (3 x 102) + (3 x 101) + (7 x 100)

Page 13: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

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)

Page 14: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

14 TAG ▪ 2010

1 3 3 7

1,337

1000 100 10 1

1 1 0 1

1011

8 4 2 1

= 13

Page 15: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

15 TAG ▪ 2010

Practice

Convert from binary to decimal:

1111

0011

0111

0110

1110

=

=

=

=

=

15

3

7

6

14

Page 16: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

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)

Page 17: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

17 TAG ▪ 2010

1 3 3 7

1,337

1000 100 10 1

8 B 2 F

0x8B2F

4096 256 16 1

= 35,631

Page 18: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

18 TAG ▪ 2010

Practice

Convert from binary to hex:

1001

0011

1010

1110

0111

=

=

=

=

=

0x9

0x3

0xA

0xE

0x7

Page 19: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

19 TAG ▪ 2010

Practice

Convert from hex to decimal:

0x0C

0x2F

0xFF

0xFB

=

=

=

=

12

47

255

251

Page 20: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

20 TAG ▪ 2010

Practice

Identify most-significant bit:

0x0C

0x80

0x90

0xB8

0

1

0

1

Page 21: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

TAG ▪ 201021

Do it in C#

Page 22: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

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

Page 23: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

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

Page 24: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

24 TAG ▪ 2010

Types of programming languages

Compiled Interpreted

Statically typed Dynamically typed

Page 25: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

25 TAG ▪ 2010

Color

RGB

CMYK

Page 26: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

26 TAG ▪ 2010

Red

GreenBlue

Cyan

Magenta Yellow

Page 27: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

27 TAG ▪ 2010

Hue: 0 - 360°Saturation: 0 - 100%Value (Brightness): 0 – 100%

Page 28: CIS 3260 Introduction to Programming Using C#. Tom Gregory Center for Process Innovation Soccer Referee Boy Scout leader B.S. Computer Science MBA Developer

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 &