Download presentation
Presentation is loading. Please wait.
Published byJesse Davis Modified over 9 years ago
1
1 COMS 261 Computer Science I Title: C++ Fundamentals Date: September 05, 2005 Lecture Number: 4
2
2 Announcements Homework Assignment –Continue reading Chapter 2 –Should have read 1.1 – 1.2, 2.1 – 2.5 before lab on Thursday –Read/skim the lab for Thursday Bring lab handout to lab (class) on Thursday
3
3 Review Decimal to binary conversion Fetch/Execute cycle Programming –Machine Language –Assembly Language –High-Level Languages Think – Edit – Compile – Execute - Test Cycle
4
4 Outline IDE –Code Warrior Program Organization Objects First C++ Program –Hello, World
5
5 Assembly Programming Machine Language Program Execute (run) Program Assembly Language Program Think Editor Object Code Different Input Test Cases Assembler abstraction
6
6 HLL Programming Machine Language Program Think Assembler Editor Compiler Assembly Language Program C++/Fortran Language Program Math Library Object Code Linker Execute (run) Program abstraction Further away from machine details
7
7 IDE’s Integrated Development Environments –Provides a user interface for the development process Editor, Compiler, Linker, Loader, Debugger, Viewer –We will be using the CodeWarrior IDE throughout this course Show CodeWarrior
8
Program statement –Definition –Declaration –Action Program Organization
9
C++ program –Collection of declarations, definitions, and functions –Program can span multiple files Large programs should span multiple files –Object-oriented approach to programming
10
Object Represents information –Name –Values or properties Data members –Ability to react to requests (messages)!! Member functions
11
Object When an object receives a message, one of two actions are performed –Object is directed to perform a specified action Return a value –Object changes one of its properties
12
// Program: Hello // Author(s): Haul Pemler // Date: 10/05/2005 #include using namespace std; int main() { cout << "Hello world!" << endl; return 0; } A First Program - Hello.cpp Preprocessor directives Insertion statement Ends executions of main() which ends program Comments Function Function named main() indicates start of program Provides simple access String Literal
13
A First Program - Hello.cpp Comments –Not executed, so use them liberally to document your code –Program and programmer name, date, what the program should do, special assumptions, input required, output produced, … // Program: Hello // Author(s): Haul Pemler // Date: 10/05/2005
14
#include A First Program - Hello.cpp Preprocessor Directives –Program executed before the compiler Program #include means that the contents of the file named in the angle brackets should be input –Usually contains common definations There are other types of preprocessor directives
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.