An Overview of Object-Oriented Programming in C++
An Overview of Object-Oriented Programming in C++
An Overview of Object-Oriented Programming in C++
Programming in C++
Lecture 1
An Overview of Object-Oriented Programming in C++
2
Faculty of Computer Science
Definitions of programming
• Conventional definitions
A plan for solving a problem on a computer
Specifying the order of a program execution
• modern programs often involve millions of lines of code
• manipulation of data is central
“Programming is understanding”
• When you can program a task, you understand it
• When you program, you spend significant time trying to
understand the task you want to automate
• Computers
– built by people for the use of people.
– a very generic tool; use for an unimaginable range of tasks
– takes a program to make it useful to someone
12
Faculty of Computer Science
Compilers and Interpreters
Monitoring
Engine
• Design
Hull design
• Construction
Pumps
• Management
Signal processing
• Communication “Gadget” control
• Control Monitoring
• Display
• Control Communications
• Monitoring Visualization
• Analysis Manufacturing
• Design
Primary
Memory
CPU CPU takes each
instruction and
executes it, possibly
storing new data
.
values as the program 30
.
executes.
Faculty of Computer Science 31
Important Terms
• A source program (.cpp file type) consists of the program
statements comprising a C++ or other programming language
program.
• Different users can create separate namespaces and thus can use
similar names of the entities.
• Avoids compile-time error that may exist due to identical-name
conflicts.
• In modern C++, all of the functionality in the C++ standard
library is now defined inside namespace std (short for standard).
39
Hello, world! Program
Its purpose is to help you get used to your tools
• Compiler
• Program development environment
• Program execution environment
Type in the program carefully
• After you get it to work, please make a few mistakes to see how the
tools respond; for example
Forget the header
Forget to terminate the string
Misspell return (e.g., retrun)
Forget a semicolon
Forget { or }
… 40
Compilation and Linking
C++ source code
C++ compiler
Object code
Executable program
linker
Library Object code
#include<iostream>
using namespace std;
int main()
{
cout<<"Hello World ! ! !\n";
system("pause");
system("cls");
}
Print numbers
// #include
<< library
C++ linker
comment main()
compiler object code
compile-time error output
cout program
executable source code
function statement
header IDE