Chew Code | Guide to Computer Programming Basics

Get C++ Tutorials, Projects, Practicals, Practice Papers for CBSE Class 12 & 11.

Use of relational and logical operators in C++

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...

Precedence of operators in C++ and expression evaluation

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...

Meaning of implicit and explicit type conversion in C++

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...

What is the use of Conditional Operator in C++?

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. (adsbygoogle = window.adsbygoogle || []).push({}); Lets see how this operator works. First thing we need to know...

How to use Increment (++) and Decrement (- -) Operators in C++ ?

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...

Various Data Type Modifiers in C++ : signed, unsigned, long, short

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...

How to Implement Captcha in ASP.Net & C# Project

Spamming is a common issue with online web-based applications these days. Especially in those applications and websites which are open to the public, it is hard to find and fight spam. Even big websites such as GitHub have been suffering from such issues. Hence, it is mandatory to use some form of mechanism to avoid and fight spam in an automated manner. The globally accepted mechanism to fight spamming is CAPTCHA...

Difference between String and StringBuilder in C#

String and StringBuilder are yet another concept in C# which often goes neglected. Everytime a programmer has to save some string into a variable, they simply declare a string in their program and use it. But in the long term and in big projects, it often leads to high memory consumption. In this article, we will explain why this happen and how to avoid it using StringBuilder. The difference between string and...

What are the Various Arithmetic Operators used in C++ ?

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...

How to fix the value of a variable using const keyword in C++

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...