Category: 10. C++

  • Operators in C++

    An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. C++ is rich in built-in operators and provide the following types of operators − This chapter will examine the arithmetic, relational, logical, bitwise, assignment and other operators one by one. Arithmetic Operators Arithmetic operators in C++ are the basic operators,…

  • Storage Classes in C++

    A storage class defines the scope (visibility) and life-time of variables and/or functions within a C++ Program. These specifiers precede the type that they modify. There are following storage classes, which can be used in a C++ Program The auto Storage Class The auto storage class is the default storage class for all local variables. Example Below…

  • C++ Modifier Types

    C++ allows the char, int, and double data types to have modifiers preceding them. A modifier is used to alter the meaning of the base type so that it more precisely fits the needs of various situations. The data type modifiers are listed here − The modifiers signed, unsigned, long, and short can be applied to integer base types. In addition, signed and unsigned can be applied…

  • C++ Constants/Literals

    Constants refer to fixed values that the program may not alter and they are called literals. Constants can be of any of the basic data types and can be divided into Integer Numerals, Floating-Point Numerals, Characters, Strings and Boolean Values. Again, constants are treated just like regular variables except that their values cannot be modified after their definition. Integer Literals…

  • C++ Basic Input/Output

    The C++ standard libraries provide an extensive set of input/output capabilities which we will see in subsequent chapters. This chapter will discuss very basic and most common I/O operations required for C++ programming. C++ I/O occurs in streams, which are sequences of bytes. If bytes flow from a device like a keyboard, a disk drive,…

  • C++ Declare Multiple Variables

    C++ programming language allows programmers to declare multiple variables in a single statement without any line breaks. This is only possible for variables which belong to the same data type. How to Declare Multiple Variables in C++? This is executed using a comma (,) separated list of variables with different variables names, and the data types must be the…

  • Variable Scope in C++

    A scope is a region of the program and broadly speaking there are three places, where variables can be declared − C++ variables scopes are categorized mainly two parts − We will learn what is a function and it’s parameter in subsequent chapters. Here let us explain what are local and global variables. Local Variables…

  • C++ Variables and Types

    C++ Variable A variable provides us with named storage that our programs can manipulate. Each variable in C++ has a specific type, which determines the size and layout of the variable’s memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.…

  • C++ Boolean (bool) Data Type

    The bool data type in C++ stands for Boolean values, which are True and False. In C++, 1 stands for True whereas 0 stands for False. The keyword “bool” is used to declare a Boolean data type. The addition of bool data type is a one of the newer features of C++ language. Use of Boolean Data Type The Boolean (bool) data type is used in the following ways…

  • C++ Character (char) Data Type

    The character (char) data type in C++ stands for alphanumeric values, which can be a wide range of characters. These may include alphabets like ‘a’, ‘b’, and ‘c’, numeric values like ‘1’, ‘2’, and ‘3’, symbols like ‘#’, ‘$’, and ‘&’, and many more. The character data type takes 1 Byte (i.e., 8 bits) of memory space to store…