Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow...
-
Upload
walter-walters -
Category
Documents
-
view
213 -
download
0
Transcript of Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow...
![Page 1: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/1.jpg)
Introduction to C# ProgrammingVersion 1.1
![Page 2: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/2.jpg)
Objectives
Help you learn to read and follow instructions
Look at how and why we write programs
Describe some things it takes to learn to be a programmer
Discuss some important programming tools
Investigate how the computer works as it executes a program
Describe the steps involved in creating and running a program
![Page 3: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/3.jpg)
Course Materials
ScheduleSyllabusSlidesExample Programsetc.
ftp://cseftp.tc.uvu.educns/fairclde/Spring 2011/CS1400
![Page 4: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/4.jpg)
C# is programming language
Programming languages allow us to communicate with the computer. Just as English is a verbal/written language to allow us to communicate with other people.
We can’t speak with computers, we can only write to them. This written language is called a PROGRAM!
C# programs are written in text then compiled (translated) from text to binary machine language that the computer understands.
![Page 5: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/5.jpg)
Visual C# 2010 Express
Visual C# 2010 is a programming environment– Sophisticated Text Editor– Compiler– Lots of neat tools to help us!
![Page 6: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/6.jpg)
Basic C# Program
static class Program{ static void main( ) { System.Console.WriteLine("Hello, world"); System.Console.Write("Press any key to
continue ..."); System.Console.ReadLine(); }}
![Page 7: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/7.jpg)
Improved Basic C# Program
using System;static class Program{ static void main( ) {
Console.WriteLine("Hello, world"); Console.Write("Press any key to
continue ..."); Console.ReadLine(); }}
![Page 8: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/8.jpg)
Compile and Run It!
Press F5 Button orGreen “Shazam” Button
![Page 9: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/9.jpg)
Lab01
See how it works, see how Jack runs!
![Page 10: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/10.jpg)
Now Zip it and Email it!Go to the project folder.
– Documents, Visual Studio 2010, Projects
Right click on lab01.– Send To, Compressed (Zipped)
Folder.– lab01.zip– Rename to lab01dafv1.0.zipd
Attach to email andEmail to [email protected]
– Subject: CS1400 lab01dafv1.0
![Page 11: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/11.jpg)
Why would you want to learn to program?
• The sheer joy of making things – being creative • The pride in making something that is useful to other
people• The fascination of solving complex problems• Figuring out how to do something you’ve never done
before• Making a dumb machine do smart things• Earning a lot of money• This class is required …
![Page 12: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/12.jpg)
Comment from a student …
“I want a career, not just a degree”
![Page 13: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/13.jpg)
![Page 14: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/14.jpg)
This is about $80k/yr
![Page 15: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/15.jpg)
Robotics
![Page 17: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/17.jpg)
Computer Graphics/Animation
![Page 19: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/19.jpg)
Entertainment/Communication
![Page 20: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/20.jpg)
Web Applications
![Page 21: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/21.jpg)
Business/Finance
![Page 22: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/22.jpg)
Engineering
![Page 23: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/23.jpg)
Learning to program requires
• Time• Patience• Good language skills• The ability to think abstractly• Good math skills• The ability to solve problems• Practice – Program, program, program• A sense of curiosity
![Page 24: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/24.jpg)
Learning to Program Takes Time
Researchers have shown that learning to do anything well(playing the piano, painting, playing tennis, etc) takes about 10 years. Learning to be a good programmer is nodifferent.
To become proficient at programming Practice Practice Practice …
![Page 25: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/25.jpg)
The rise of mathematics is heating up the job market for luminary quant's, especially at the Internet powerhouses where new math grads land six-figure salaries and rich stock deals. Tom Leighton, an entrepreneur and applied math professor at Massachusetts Institute of Technology, says: "All of my students have standing offers at Yahoo! and Google. Top mathematicians are becoming a new global elite. It's a force of barely 5,000, by some guesstimates, but every bit as powerful as the armies of Harvard University MBAs who shook up corner suites a generation ago.
Math Skills are Important
Business Week Cover StoryJanuary 23, 2006
![Page 26: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/26.jpg)
![Page 27: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/27.jpg)
What do Programmers Do?
They talk to their customers They talk to their peersThey discuss problemsThey think a lotThey write a lotThey design solutions to problemsThey write codeThey debug codeThey refactor codeThey test codeThey document codeThey fix code. . .
![Page 28: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/28.jpg)
![Page 29: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/29.jpg)
![Page 30: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/30.jpg)
Google Offices
![Page 31: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/31.jpg)
Programming Tools
The computerThe operating systemThe code editorThe compilerThe debugger
IntegratedDevelopmentEnvironment
(IDE)
Problem solving skillsLanguage skills
![Page 32: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/32.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Memory
Program Counter
Instruction Register
General Purpose Registers
Status Registers
Arithmetic andLogic Unit
CPU
![Page 33: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/33.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
General Purpose Register
Status Registers
Arithmetic andLogic Unit
![Page 34: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/34.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
General Purpose Register
Status Registers
Arithmetic andLogic Unit
Watch how the computer adds two numbers together …
![Page 35: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/35.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
60
addressThe program to be executed isstored in the code segment.The data is stored in the datasegment. The program counterpoints to the next instructionto be executed.
![Page 36: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/36.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
60
address
![Page 37: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/37.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
60
address
ld r1, 24
![Page 38: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/38.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
60
address
10
ld r1, 24
![Page 39: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/39.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
64
address
10
ld r1, 24
10
![Page 40: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/40.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
64
address
10
ld r1, 24
10
ld r2, 28
![Page 41: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/41.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
64
address
10
ld r2, 28
10
12
![Page 42: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/42.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
68
address
10
ld r2, 28
10
12
![Page 43: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/43.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
68
address
10
ld r2, 28
10
12
add r1, r2
![Page 44: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/44.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
68
address
10
add r1, r2
10
12
10
12
22
![Page 45: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/45.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
68
address
10
add r1, r2
10
12
22
![Page 46: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/46.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012--
242832
60646872
72
address
10
ld r1, 24
22
12
sto r1, 32
![Page 47: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/47.jpg)
The Computer
DataSegment
CodeSegment
Stack
Heap
Program Counter
Instruction Register
Register r1
Arithmetic andLogic Unit
ld r1, 24ld r2, 28add r1, r2sto r1, 32
Register r2
1012
242832
60646872
72
address
10
sto r1, 32
22
12
22
![Page 48: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/48.jpg)
The Operating System
Manages the memory in the computerManages how and when programs are executedManages the devices attached to the computer and lots of other stuff …
![Page 49: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/49.jpg)
The code editor provides a way forThe programmer to create and edit thesource code text for his or her program.
Editors provide tools to cut and paste sourceCode text, move between source code files,and do many other editing tasks.
![Page 50: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/50.jpg)
![Page 51: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/51.jpg)
static void Main( ){ int a = 5; int b = 27; . . .
source codecompiler
The Compiler
![Page 52: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/52.jpg)
XvnvyiLklil
98Hjfkkfol09Op kij
PlollkEtc…
IntermediateLanguage
source codecompiler
![Page 53: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/53.jpg)
XvnvyiLklil
98Hjfkkfol09Op kij
PlollkEtc…
IntermediateLanguage
Interpreter
compilersource code
code segment
data segment
stack segment
.exe
![Page 54: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/54.jpg)
reserved foroperating
system
program A
program B
the heapthe heap is left overmemory, not being usedby any program. It ismanaged by the O/S.
code segment
data segment
stack segment
loader
program C
![Page 55: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/55.jpg)
Visual C# Express Edition is an
Integrated Development Environment (IDE).It includes
* a code editor * a compiler * a debugger * and other development tools
![Page 56: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/56.jpg)
If you have not completed lab #1,be sure to complete it and turn it inper the course schedule.
![Page 57: Introduction to C# Programming Version 1.1. Objectives Help you learn to read and follow instructions Look at how and why we write programs Describe.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfeb1a28abf838cb7cd9/html5/thumbnails/57.jpg)
Questions?