160 likes | 253 Views
COP1220/CGS2423 Introduction to C++/ C for Engineers. Professor: Dr. Miguel Alonso Jr. Fall 2008. Outline. Why Program? Computer Systems: Hardware and Software Programs and Programming Languages What is a Program Made of? Input, Processing, and Output The Programming Process
E N D
COP1220/CGS2423Introduction to C++/C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008
Outline • Why Program? • Computer Systems: Hardware and Software • Programs and Programming Languages • What is a Program Made of? • Input, Processing, and Output • The Programming Process • Procedural and Object-Oriented Programming
Why Program? • What does a computer do? • It is useful because it can be programmed, or told to do many different tasks. • They are tools that make almost every profession easier to do. • A computer is a machine specifically designed to follow instructions.
Why Program? • Programs are called software, or a set of instructions that tells a computer what to do. • Programs in the real world consist of the following: • Logical flow of instructions • Mathematical procedures • Appearance on the screen • The way the information is presented to the user • The programs “user-friendliness” • Manuals and other written documentation
Computer Systems: Hardware and Software Starting out with C++, Pearson, (2006)
Computer Systems: Hardware and Software Starting out with C++, Pearson, (2006)
Computer Systems: Hardware and Software • CPU: Controls the computer’s operations and performs arithmetic functions • Main Memory: Random Access Memory, or RAM, is the part of a computer that temporarily holds or stores information • Consists of cells and bits (a “switch” that can be a 0 or 1 • Each Cell has 8 bits, or a byte. • Each cell is assigned a location number called an address.
Other Devices • Secondary Storage: Hard Disk, USB Stick • Input Devices: Any devices that help the computer collect information from the outside world • Output Devices: Devices that presents the computer’s information to the outside world.
Software • Generally two categories of software in a computer: • Operating system • Application Software • Single Tasking • Multi-Tasking • Single-User • Multi-User
Programs and Programming Languages • Computer Program: Set of instructions that tells a computer how to solve a problem or perform a task • Algorithm: A set of well defined steps for performing a task or solving a problem • A computer only understands 0’s and 1’s • Programming Languages were invented to ease the task of programming • Examples of Languages: C/C++, C#, JAVA
Programming Languages • Low Level vs High Level • Your very first program!
What is a program made of? • Language Elements
Lines, Statements, and Variables • Line: single line as it appears in the body of the program (can be empty) • Statement: complete instruction that causes the computer to perform an action • Variable: named storage location in the computers memory for holding a piece of information. Usually stored in RAM. • Variable definition/declaration • Not the same thing! • There are generally two types of variables: numbers and characters. • Number: used to compute • Characters: used for display