You Are Browsing **‘CBSE Class 12’** Category

**‘CBSE Class 12’**Category

In this lesson, we will learn about the various relational and logical operators in c++ and how they are used in forming expressions. One thing common to both these operators is that they evaluate to either a true or a false value. A true value is denoted by 1 and a false value is denoted by 0 in C++. 1. Relational Operators Let’s begin with relational operators. They are used to determine the relation...

So far we have gone through the following operators in C++: Arithmetic Operators Increment and Decrement Operators Relational Operators Logical Operators Conditional Operator Assignment Operators Now let’s first understand what is meant by an expression. An expression is a sequence consisting of variables, constants and operators which specify a computation. That is, an expression can be evaluated to...

This lesson focuses on expressions consisting of mixed data types. The C++ compiler has a way to deal with expressions that contains variables or constants which have different data types. So if we have two different types of variables/constants in an expression, they can be converted to one single type (either by the compiler or explicitly by the programmer). This process is known as type conversion in C++. For...

There is a special operator called conditional operator in C++ programming language, denoted by ?: symbol. It is way different from the other operators in C++ programming language and provides a convenient way to take an action depending on the truth or falsity of a condition. Lets see how this operator works. First thing we need to know is that condition operator is a ternary operator. This means it takes...

Previously we had seen the various arithmetic operators in C++. Now let us have a look at two new operators called the increment (++) and decrement (- -) operators. Both these operators are unary operators. That means they work only on one operand. They can be used in two ways : 1. Prefix form 2. Postfix form Let us see each of these operators in both the forms stated above. 1. INCREMENT OPERATOR (++) The increment...

Now that we know the various data types used in C++ language, let us see how we can modify these data types to provide more versatility to our code. We have the following four data type modifiers in C++ : signed unsigned long short First let us discuss some imporant points about these modifiers. If we use ‘signed’ before a variable declaration, it means that the variable can hold both positive...

C++ programming language provides us with various types of operators for performing different tasks. One such class of operators is arithmetic operators. These are used for performing arithmetic calculations in a program. Following is a list of the C++ arithmetic operators: Addition operator: ‘ + ‘ Subtraction operator: ‘ – ‘ Multiplication Operator: ‘ * ‘ Division...

A variable is an entity whose value can vary in a program. But sometimes, we need to fix the value of a variable for some purpose. For example, to calculate the area of a circle, we can store the value of PI which is 3.14 in a variable. However we need to make sure that this value is not altered in the program otherwise we may get wrong results. So to fix the value of a variable, we use the keyword const before...