You Are Browsing ‘Tutorials’ Category

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. Lets see how this operator works. First thing we need to know is that condition operator is a ternary operator. This means it takes...

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

What are Various Types of Constants in C++ and their Use

We had given an introduction to constants when we had talked about the different types of tokens in C++. Now let us study constants in detail and see how they are used in C++ programs. First let us recall what constants are. DEFINITION : They are data items that do not change during a program. They are also called literals. So both the terms constants and literals are used interchangeably. TYPES OF CONSTANTS/LITERALS...

How to Declare and Initialize Variables in C++ – Tutorial for Beginners

In the previous post, we had seen what are the various built-in data types in C++. We are now ready to use them to create variables in our programs. First let us see what variables actually are and how they work. Definition : Variables are symbolic names given to memory locations that store various values. In other words, when we declare a variable and assign it any value, that value gets stored in memory at...

Built-In Data Types in C++: char, int, float, double

Data types in C++ are keywords that are used to specify the type of the data we use in our C++ programs. There are many data-types available in C++. They are classified under two categories: Built-In or Fundamental Data types Derived or User-Defined Data types Built-in data types Built-in data types are the most basic data-types in C++. The term built-in means that they are pre-defined in C++ and can be used...