Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Learn C++
Learn C++
Learn C++
Ebook151 pages1 hour

Learn C++

Rating: 4.5 out of 5 stars

4.5/5

()

Read preview

About this ebook

C++ (C plus plus) is a general purpose programming language based on the C programming language. In addition to facilities provided by C, C++ provides classes, inline functions, operator overloading, constant type references, free store management operators, etc.
The new language was known as "C with classes" initially. However in 1983, the name was changed to C++. C++ blends the high efficiency and stylistic elements of C with the object-oriented paradigm. It is a machine-independent language and is considered an industry standard language. C++ has been in use for large software projects. Stability and compatibility have been important considerations in the development of the language.
The development of C++ was not an attempt to create a completely new programming language. Instead it was an enhancement to an already highly successful one. C++ was standardized on 1977 and the ANSI / ISO (American National Standards Institute / International Standards Organization) standard for C++ is now available.

LanguageEnglish
PublisherDurgesh
Release dateSep 18, 2017
ISBN9781370946334
Learn C++
Author

Durgesh

Major part of my career has been in the field of Education and Administration. I have a good command over my subject (computer science) and effective communication in English. I have written books in my subject and have represented Science Olympiad Foundation. I have been very adaptable to any kind of new environment and technologies. I have written a few computer science books for my students based on their syllabus.With lots of health issues cropping up with time, I recreated myself with the help of Yoga and Meditation. Which gave me a direction towards a happy mind and body.Thus, decided to share my experience in penning down the Good Health Technique with all.I am ever grateful to Guruji, Sri Sri Ravi Shankarji and to Swami Satyananda Saraswatiji for guidance towards ultimate physical and mental good health.Lately I have picked up a new hobby - the art of crocheting. While making some crochet related products, I have written a few amigurumi patterns. Sharing my new skill through this platform.

Read more from Durgesh

Related to Learn C++

Related ebooks

Study Guides For You

View More

Related articles

Reviews for Learn C++

Rating: 4.333333333333333 out of 5 stars
4.5/5

9 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Learn C++ - Durgesh

    Learn C++

    For My Computer Sc. Students

    By Durgesh

    Contents

    1. C Character Set

    2. Data Types

    4. C++ Tokens

    5. Operators

    6. Use of I/O Operators

    7. Structure of C++ Program

    8. Operators & Expressions

    9. Precedence of Operators

    10. Expressions

    11. Program Control Statements

    12. Selective Structure: switch

    13. Iterative Statement: for Loop

    14. Iterative Statement: while Loop

    15. Iterative Statement: do-while Loop

    16. Bifurcation of Control

    17. I/O Functions

    18. Single Character Functions

    19. Structured Data Type: Arrays

    20. Types of Arrays

    21. Strings

    22. Functions

    23. Scope Rules

    24. Header Files

    25. Character and String Functions

    26. Math & Conversion Functions

    27. Structures

    28. Structures and Arrays

    29. Classes and Objects

    30. Constructors

    31. Destructors

    32. Function Overloading

    33. Inheritance

    34. Pointers

    35. Memory Management

    36. Input/Output of Files

    Introduction

    C++ (C plus plus) is a general purpose programming language based on the C programming language. In addition to facilities provided by C, C++ provides classes, inline functions, operator overloading, constant type references, free store management operators, etc.

    By adding object-oriented features attributes and benefits, C++ was developed by Bjarne Stroustrup in 1980. The new language was known as C with classes initially. However in 1983, the name was changed to C++.

    The development of C++ was not an attempt to create a completely new programming language. Instead it was an enhancement to an already highly successful one. C++ was standardized on 1977 and the ANSI / ISO (American National Standards Institute / International Standards Organization) standard for C++ is now available.

    C++ blends the high efficiency and stylistic elements of C with the object-oriented paradigm. It is a machine-independent language and is considered an industry standard language. C++ has been in use for large software projects. Stability and compatibility have been important considerations in the development of the language.

    C++ Character Set

    Character sets affect the fundamental part of the program code, the storage and transmission of data and the logic with which you manipulate text.

    Source Code Character Set

    A C++ compiler uses any character set that includes at least the following characters:

    The 52 upper case and lower case alphabetic characters ( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z ), the 10 decimal digits ( 0 1 2 3 4 5 6 7 8 9 ), the blank or space character and 29 designated graphic characters ( ! # % ^ - _ + = ~ [ ] \ | ; : ' " { } . , < > / ? ).

    Five formatting characters (backspace horizontal tab, vertical tab, form feed, and carriage return) are often used in C++ (formatting characters are treated as spaces). The dollar sign ($) and the at sign (@) are also commonly used.

    Execution Character Set

    The execution character set for C++ is required to have the standard characters of the source code character set, plus a null character and a new line character. This null character must have the value 0 and is used to mark the end of strings.

    White Space

    White space in C++ includes the blank (space character), horizontal tab, end-of-line, vertical tab, form feed, and comments. White space is ignored by the compiler and therefore can be freely used by the programmer.

    Line Termination

    Each line in a C++ source program is terminated with an end-of-line character or character sequence. Certain formatting (such as carriage return, form feed or vertical tab) can also terminate lines.

    Data Types

    Data type is defined as the set of possible values a variable can hold. Data types in C++ can be divided into three categories:

    1. Built-in Data Type

    2. User Defined Data Type

    3. Derived Data Type

    Built-in Data Types

    The C++ compiler supports all the built-in data types. These data types are also known as standard data types and are not composed of other data types.

    Data type modifiers

    A modifier is used to change the meaning of the basic data type according to the requirement of the program. The modifiers signed, unsigned, long, and short may be applied to basic data types (integer, character). Long float is not used because it is equivalent to double. Modifiers cannot be used with void type.

    Data Types and sizes

    Type Number of Bits

    char 8

    short 16

    int 32

    long 32

    float 32

    double 64

    void none

    Integers

    Integer data types (int) are whole numbers in use in C++. The size of integers is 2 bytes. Three types of integers are used in C++.

    1. Signed / unsigned integers

    2. Short integers

    3. Long Integers

    Signed Integer

    A signed integer (signed int) is a positive or negative integer. The range of signed integers is from -32768 to +32767.

    Unsigned integer

    Unsigned integers do not have negative values. These integers accept only zero and positive values. The size of unsigned integers is 2 bytes. They can range from 0 to 655357.

    Short integers

    Short integers have a small range of values. The range of short integers is from -128 to 127. The size is 1 byte.

    Long integers

    The range of long integers is from -2^32 to 2^32. The size is 4 bytes.

    Examples of valid integers: 439, 11, 20495, -126

    Examples of invalid integers: 961.21 (float), 4,325 (comma is not allowed), 81 562 (blank space within a number is not allowed).

    Floating point (float)

    Floating point variables are used to store real numbers (numbers involving decimals). The range of floating point type is from 3.4 x 10^-38 to 3.4 x 10^38 and the size is 4 bytes. Type float provides approx. 7 digits of precision. Three types of floats are used in C++: Float, Double, Long Double. A floating point number can be represented in two forms: decimal form and exponent form.

    Examples of Decimal form: 250.46, -1738.72, 8.39

    Examples of Invalid Float: 16,433.67 (comma used), -84 (no decimal point)

    Examples of Exponent Form: 52940000 -- 5.294 x 10^6

    0.8731 -- 8.731 x 10^-1

    0.4269 -- 4.269 x 10-8

    Examples of Valid Forms

    4.321 x 10^6 = 4.321E6

    = 4.321E+6

    = 4.321E06

    4.321 x 10^-6 = 4.321E-6

    The part to the left of

    Enjoying the preview?
    Page 1 of 1