02 | core programming gerry o’brien | technical content development manager paul pardi | senior...

Post on 14-Dec-2015

214 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Click to edit Master subtitle style

02 | Core Programming

Gerry O’Brien | Technical Content Development ManagerPaul Pardi | Senior Content Publishing Manager

• How Computers Store and Manipulate Information

• Data Structures

• Algorithms

• Decision Making

• Repetition

• Program Errors

Module Overview

Computer Storage and Processing

Variables, Constants, and Data Types• Variable – provides a temporary, named storage location in computer

memory

• Constant – either a named storage location or literal value. Cannot be changed during program execution

• Data Types – numeric, character, specialData Type Range Description

byte 0 to 255 A single byte (8 bits)

char Any Unicode character Characters used in most languages in the world

short -32,768 to 32,767 Signed integer values

int -2,147,483,648 to 2,147,483,647 Larger signed integer values

long 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

Even larger signed integer values

float +/- 1.5 x 10-45 to +/- 3.4 x1038 Floating point signed values

Double +/- 5.0e -324 to +/- 1.7e308 Large floating point signed values

String String of characters Words, sentences, phrases, etc.

Boolean True or False Used to represent true or false, 1 or 0

Data Structures

• Arrays

• Stacks

• Queues

• Dictionaries

Arrays

• A collection of similar data types accessed by index

Index Value

0 Item1

1 Item2

2 Item3

3 Item4

4 Item5

5 Item6

6 Item7

7 Item8

8 Item9

9 Item10

Stack

• A collection of objects, accessed by pop and push

Queue

• A collection of objects, accessed by queuing and dequeuing. Similar to a line at the motor vehicle license branch

Enqueue Dequeue

Dictionary

• A collection of objects that are accessed by using a key

Key Value

Key1 First Item

Key2 Second Item

Key3 Third Item

Key4 Fourth Item

Key5 Fifth Item

Demo Data Structures

AlgorithmsStart Pancakes

Add Eggs

Add Flour

Add Water

Mix

Proper Consistency?

Pour in Pan

Serve and Eat

DoneToo Thick?

No

No

Yes

Yes

Start Bubble Sort

Get Value One

Get Value Two

Is Two Greater than One?

End of List?

List Sorted

Swap One and Two

Increment Values

Paul Pardi
Do you need your yes/no on the arrows for the bubble sort?

Decision Making

• if, if-else, if-else-if

• switch or Select Case

Demo Decision Structures

Repetition

• for loops

• while loops

• do-while loops

• recursion

Demo Repetition

Program Errors

• Syntax errors

• Logic errors

• Exceptions

• Structured Exception Handling

• Using the debugger

Demo Errors and Debugging

©2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

top related