1 / 14

Programming in C++

Programming in C++. Objectives. To describe the fundamental characteristics of the object oriented C++ programming language. To introduce the steps necessary for creating a fully functional C++ program. Types of programming languages. Three types of programming languages Machine languages

reegan
Download Presentation

Programming in C++

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming in C++

  2. Objectives • To describe the fundamental characteristics of the object oriented C++ programming language. • To introduce the steps necessary for creating a fully functional C++ program.

  3. Types of programming languages • Three types of programming languages • Machine languages • Strings of numbers giving machine specific instructions • Example: +1300042774+1400593419+1200274027 • Assembly languages • English-like abbreviations representing elementary computer operations (translated via assemblers) • Example: LOAD BASEPAYADD OVERPAYSTORE GROSSPAY

  4. Types of programming languages • High-level languages • Similar to everyday English, use mathematical notations (translated via compilers) • Example: grossPay = basePay + overTimePay

  5. Some of high-level languages • C++ • Built from pieces called classes and functions • Provides capabilities for object-oriented programming • JAVA • Used to create web pages with dynamic and interactive content • Develop large-scale enterprise applications • Enhance the functionality of web servers • FORTRAN • Used in scientific and engineering applications • COBOL • Used to manipulate large amounts of data • Pascal • Used to teach structured programming

  6. Historical Perspective • The C++ programming language was created by Bjarne Stroustrup and his team at Bell Laboratories (AT&T, USA) to help implement simulation projects in an object-oriented and efficient way. • The earliest versions, “C with classes,” date back to 1980. • C++ was derived from the C programming language: ++ is the increment operator in C. • In 1998 the ISO (International Organization for Standardization) approved a standard for C++ (ISO/IEC 14882).

  7. Characteristics of C++ • C++ is not a purely object-oriented language but a hybrid => you have all the features that are available in C: • Universally usable modular programs • Efficient, close to the machine programming • Portable programs for various platforms.

  8. OOP • C++ supports the concepts of object-oriented programming (or OOP for short) which are: • data abstraction, that is, the creation of classes to describe objects • data encapsulation for controlled access to object data • inheritanceby creating derived classes (including multiple derived classes) • polymorphism (Greek for multiform), that is, the implementation of instructions that can have varying effects during program execution.

  9. OBJECT-ORIENTED PROGRAMMING In traditional, procedural programming, data and functions are kept separate from the data they process. This has a significant effect on the way a program handles data: ■ the programmer must ensure that data are initialized with suitable values before use and that suitable data are passed to a function when it is called. ■ if the data representation is changed, functions must also be modified.

  10. OBJECT-ORIENTED PROGRAMMING Object-oriented programming  object(s) OOP objects combine data (properties) and functions (capacities).

  11. Advantages of OOP ■ Reduced susceptibility to errors: an object controls access to its own data. ■ Easy re-use: objects maintain themselves. ■ Low maintenance requirement: an object type can modify its own internal data representation without requiring changes to the application.

  12. To use a C++ langauge! • C++ programs • Built from pieces called classes and functions • C++ standard library • Provides rich collections of existing classes and functions for all programmers to use

  13. Create and translate a C++ program

  14. Sample program #include <iostream> using namespace std; int main() { cout << "Enjoy yourself with C++!" << endl; return 0; }

More Related