Author: saqibkhan

  • Numbers in C++

    Normally, when we work with Numbers, we use primitive data types such as int, short, long, float and double, etc. The number data types, their possible values and number ranges have been explained while discussing C++ Data Types. Defining Numbers in C++ You have already defined numbers in various examples given in previous chapters. Here…

  • Foreach Loop in C++

    Foreach loop is also known as range-based for loop, it’s a way to iterate over elements through a container (like array, vector, list) in a simple and readable manner without performing any extra performance like initialization, increment/decrement, and loop termination or exit condition. Syntax The following is the syntax of for each loop − Here, How Foreach…

  • Loop Types

    There may be a situation, when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on. Programming languages provide various control structures that allow for more complicated execution paths. A loop…

  • decision making statements

    Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. Following is the…

  • 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…

  • 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…

  • 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…

  • 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,…

  • 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…