C++

FIELDS OF STUDY

Programming languages; Software; Software engineering

ABSTRACT

C++ is an object-oriented programming language developed by Bjarne Stroustrup as an extension of the C programming language that preceded it. Both languages are very versatile and widely used. C++ programs use the same header-body format as C programs, but all input-output operations have been streamlined into a single header called “iostream,” with input and output controlled by the “cin >>“ and “cout <<“ operators, respectively. C and C++ are the principal languages that form the basis of the Java universal programming language.

PRINICIPAL TERMS

HISTORICAL ASPECTS AND CHARACTERISTICS OF c++

The C++ programming language was developed by Bjarne Stroustrup in the early 1980s, at Bell Laboratories as an advanced form of the C programming language. The name C++ comes from the use of the “++” modifier within the C++ language to incrementally increase the value of the variable that it modifies. The C language was developed in its turn from the BCPL language (1967) that was used for writing operating system software and compilers, and from the B language (1970) that was used to create early versions of the UNIX operating system. It is also capable of incorporating program segments written in other languages such as Assembly. C and C++ form the basis of the Java language, which is used on almost all electronic devices. C++ is an object-oriented programming language, and is “backwards compatible” with C; any program or part of a program written in C will compile and run under C++. Object-oriented programs are easier to understand, correct and modify than programming techniques characteristic of languages like BASIC and FORTRAN. A C++ program consists of two parts: a “head” and a “body.” The head of the program is a collection of class definitions and function statements, while the body contains the functions and variables that will be used to manipulate data.

CLASSES, FUNCTIONS AND OBJECTS




PRINICIPAL TERMS

This description shows how the program is assembled from various independent objects rather than being entirely self-contained as would be the case with a program written in a language such as BASIC. It should also be apparent that any of the individual functions could be utilized as is or with minor alterations in any other program.

DESIGNING A c++ PROGRAM

Much as a building is designed and constructed from various standard and customized components to achieve the desired end product, a C++ program is designed and constructed from a variety of standard and customized components. The foundation parts of the program are the libraries of standard class definitions and functions, and the syntax of the programming language. The program is typically first designed using pseudocode, which is just an easily modified “blueprint” for the construction of the actual program. An example of pseudocode might be




PRINICIPAL TERMS

SAMPLE PROBLEM

Write a simple C++ program that asks for the users name and outputs a simple greeting.

Answer:




PRINICIPAL TERMS

The iostream header is included at the beginning of every program to define the methods and formats of input and output used in C++ programs. The main() function defines the order of operations to be carried out in the program. The standard output (std∷cout <<) displays the text within quotation marks on the screen exactly as they are stated. The standard input (std∷cin >>) accepts all subsequent keystrokes in order until the “enter” key is pressed, and assigns them to a variable called “name.” The output function then prints the text phrase “Hello,” to the screen followed by the value of the variable “name” (which in this case is supposed to be the name of the person using the program, but in reality could be any string of characters that was entered after the input prompt).

IMPORTANCE AND DEVELOPMENT OF C++

The C and C++ languages are essentially universal programming languages. It is possible to write C++ programs that will compile and run on any other computer. A number of variants of the language have been developed, including Visual C++ and C#. The language is well suited to game design and programming due to the extensive libraries of calculation and graphics functions that have been developed, and its ability to incorporate modules written in compatible languages. Perhaps the most important development of C++ is that it is the foundation of the Java programming language which is used by almost every electronic device in the world as a universal standard. A program written in Java will run on any Java-enabled device of any kind, such as smartphones, calculators, programmable logic controllers, gaming consoles, tablets, guidance control systems, and many others, including computers.

—Richard M. Renneboog M.Sc.

Davis, Stephen R. (2015) Beginning Programming with C++ for Dummies 2nd ed. Joboken, NJ: John Wiley & Sons. Print.

Deitel, H.M. And Deitel, P.J. (2009) C++ for Programmers Upper Saddle River, NJ: Pearson Education Incorporated. Print.

Graham W. Seed (2012) An Introduction to Object-Oriented Programming in C++ with Applications in Computer Graphics New York, NY: Springer Science+Business Media. Print.

Kernighan, Brian W. and Ritchie, Dennis M. (1978) The C Programming Language Englewood Cliffs, NJ: Prentice-Hall. Print

Lippman, Stanley B, Lajoie, Josée and Moo, Barbara E. (2013) C++ Primer 5th ed. Upper Saddle River, NJ: Addison-Wesley. Print.

McGrath, Mike (2015) C++ Programming in Easy Steps 4th ed. Leamington Spa, UK: Easy Steps Limited. Print.

Stroustrup, Bjarne (2013) The C++ Programming Language 4th ed. Upper Saddle River, NJ: Addison-Wesley. Print.