Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Cpp-Object Oriented Programming-Lecture Slides, Slides of Object Oriented Programming

Prof. Achala Yash delivered this lecture at Ankit Institute of Technology and Science for Object Oriented Programming course. It includes: Object, Oriented, Programming, Languages, High, Performance, Computing, Superset, Library, Functional, Bjarne, Stroustrup

Typology: Slides

2011/2012

Uploaded on 07/17/2012

pankarithi
pankarithi 🇮🇳

4.6

(5)

61 documents

1 / 44

Toggle sidebar

Related documents


Partial preview of the text

Download Cpp-Object Oriented Programming-Lecture Slides and more Slides Object Oriented Programming in PDF only on Docsity!

Object Oriented Programming

Refresher Course on High Performance Computing

Module-III

Dr. Mohammad Jaudet, DEE

Mr. Arshad Iqbal, DCIS

Pakistan Institute of Engineering and Applied Sciences

August, 2010

Outline of the Lecture 05 (^1) C++ 2 Examples (^3) Example 1 (^4) Example 2 (^5) Exercises (^6) References 7 Thanks

C++ Programming Language Superset of C Language, i.e., Contains the whole C Language Structured but Not Structured because of GOTO statement cin for Input or cout for Output Statements Huge Library of Functions at Run Time (C & C++) C Compiler can Compile a C++ Compiler Compilers for Other Programming Languages can be Written in C++ Language Fully Supports both Functional and Object Oriented Programming Paradigms Developed By Bjarne Stroustrup (59, alive) in 1983

C++ Programming Language, ... One of the Most Popular Programming Languages ever Created C++ is widely used in the Software Industry. Systems Software, Application Software, Device Drivers, High Performance Server and client Applications, Embedded Software, Entertainment Software such as Video Games Several Groups Provide both Free and Proprietary C++ compiler software, including the GNU Project, Microsoft, Intel and Borland C++ has Greatly Influenced many other Popular Programming Languages, most notably Java

Examples Adding two Numbers Finding the Maximum of Two Numbers

Adding two Numbers class TwoNums { }

Adding two Numbers class TwoNums { int x, y; };

Adding two Numbers class TwoNums { int x, y; public: void set_values (int, int); };

Adding two Numbers class TwoNums { int x, y; public: void set_values (int, int); }; void TwoNums::set_values (int a, int b) { x = a; y = b; }

Adding two Numbers class TwoNums { int x, y; public: void set_values (int, int); int Sum () {return (x + y);} };

Adding two Numbers class TwoNums { int x, y; public: void set_values (int, int); int Sum () {return (x + y);} int Diff1 () {return (x - y);} };

Adding two Numbers class TwoNums { int x, y; public: void set_values (int, int); int Sum () {return (x + y);} int Diff1 () {return (x - y);} int Diff2 () {return (y - x);} };

Adding two Numbers class TwoNums { int x, y; public: void set_values (int, int); int Sum () {return (x + y);} int Diff1 () {return (x - y);} int Diff2 () {return (y - x);} ... ... };

Adding two Numbers class TwoNums { int x, y; public: void set_values (int, int); int Sum () {return (x + y);} int Diff1 () {return (x - y);} int Diff2 () {return (y - x);} ... ... }; void TwoNums::set_values (int a, int b) { x = a; y = b; }

Adding two Numbers, ... #include using namespace std;

Adding two Numbers, ... #include using namespace std; //Code from the Last Slide

Adding two Numbers, ... #include using namespace std; //Code from the Last Slide int main (void); int main (void) { };

Adding two Numbers, ... #include using namespace std; //Code from the Last Slide int main (void); int main (void) { TwoNums myTwoNums; //Declaration };

Adding two Numbers, ... #include using namespace std; //Code from the Last Slide int main (void); int main (void) { TwoNums myTwoNums; //Declaration myTwoNums.set_values (3, 4); //Instantiation };

Adding two Numbers, ... #include using namespace std; //Code from the Last Slide int main (void); int main (void) { TwoNums myTwoNums; //Declaration myTwoNums.set_values (3, 4); //Instantiation cout << "Sum: " << myTwoNums.Sum (); };

Adding two Numbers, ... #include using namespace std; //Code from the Last Slide int main (void); int main (void) { TwoNums myTwoNums; //Declaration myTwoNums.set_values (3, 4); //Instantiation cout << "Sum: " << myTwoNums.Sum (); cout << "Diff1: " << myTwoNums.Diff1 (); };

Adding two Numbers, ... #include using namespace std; //Code from the Last Slide int main (void); int main (void) { TwoNums myTwoNums; //Declaration myTwoNums.set_values (3, 4); //Instantiation cout << "Sum: " << myTwoNums.Sum (); cout << "Diff1: " << myTwoNums.Diff1 (); cout << "Diff2: " << myTwoNums.Diff2 (); };

Adding two Numbers, ... #include using namespace std; //Code from the Last Slide int main (void); int main (void) { TwoNums myTwoNums; //Declaration myTwoNums.set_values (3, 4); //Instantiation cout << "Sum: " << myTwoNums.Sum (); cout << "Diff1: " << myTwoNums.Diff1 (); cout << "Diff2: " << myTwoNums.Diff2 (); ... ... };

Adding two Numbers, ... #include using namespace std; //Code from the Last Slide int main (void); int main (void) { TwoNums myTwoNums; //Declaration myTwoNums.set_values (3, 4); //Instantiation cout << "Sum: " << myTwoNums.Sum (); cout << "Diff1: " << myTwoNums.Diff1 (); cout << "Diff2: " << myTwoNums.Diff2 (); ... ... return (0); };

Finding the Maximum of Two Numbers class TwoNums { };