C + 1 == C++ ce153c
Introduction2programming
© 2006 NematAllah Ahmadyan.
C was designed by Ritchi, Tompson,
Kernighan
It was fast, good & powerful
but program’s maintance was a nightmare!
Solution: ... Object-Oriented Programming
Object-Oriented
•
Polymorphism
•
Inheritance
•
Encapsulation
Data Abstraction
•
Operator overloading
STL { Standard Template Library }
Templates
streams
Don ’t Panic, They’ll become clear later!
“C++ is a general purpose programming language with a bias towards systems programming that
• is a better C,
• supports data abstraction,
• supports object oriented
• programming, and
• supports generic programming.
”
•
By Bjarne Stroustrup
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
}
#include <iostream>
#include <cmath>
#include <iomanip> using namespace std ; int main(){ cout << “Hello,World” << endl ; int x = sin(6.28); cout << fixed << setprecision(5) << M_PI ; cout << scientific << x<< endl ; return 0 ;
4.
5.
6.
1.
2.
3.
7.
}
...
int x = 0 , y = 1; cin >> x ; if ( x == 1 ){ y = f(3);
} else{ y = f(5);
1.
2.
} int f( int x){ return x%2 ;
C++ is very similar to C
C is a mother nature!
To all other language.
C++, Java even Matlab!
A Brief Look at C++
•
Paper by Bjarne Stroustrup
Addison Wesley - C++ Common Knowledge
Advance Programming [Java] course ce244
•
Lecturer: Ramtin Khosravi Ph.D
•
Object-Oriented Programming
K&R C Kernighan,Ritchie [ designers of C ]
The C++ Programming Language 3 rd Ed.
•
Bjarne Stroustrup [ designer of C++ ]
C Primer / C++ Primer
C++ FAQ/ C++ FAQ Lite
Dietel & Dietel C/C++/VC++/.NET
•
How to program series
Thinking in C++ Vol 1&2
Effective C++ Vol 1&2
McGraw-Hill - C & C++ Programmers Reference
Ansi/ISO C++
Numerical Recipes in C [ cambridge ]
Scientific Calculation [ MathLab ] [ math department ]