Posts

Showing posts from October, 2016
Hello everyone.Now we will discuss the relational operators. Relational Operators are generally used to define a test expression or a test condition.These are > , < , >= , <= , == , != . Note that == operator is used to check equality whereas = operator is used for assignment.There are also logical operators such as !,&& and || to negate a condition or to combine two conditions. A comma operators is used to combine several expressions together which get executed from left to right.It works as a punctuator. Ternery Operator/Conditional Operator-It is the replacement of simple Conditional operator.Its Syntax is as follows:- (condition)?True:False; Now coming to the Datatype conversions.These are of two types:- 1.Implicit 2.Explicit Implicit-In Implicit type conversion the compiler converts one data type to another automatically and it actually converts all the data upto the type of largest operand available in the expression & that is why implicit...
Hi! Today we will discuss Data type modifiers and Unary operators. Data type Modifiers- There are basically 4 datatype modifiers in C++-Signed,Unsigned,lond and short. As the name suggests, it modifies the basic datatypes and change their meaning to fit them in various situations precisely.All data types can be modified using datatype modifiers except void.For eg- unsigned int a;(It can store of positive integer which are not in range with normal integer datatype). The opposite is the function of signed int. Now long and short datatype modifiers change the amount of memory space given to a particular variable of that data type. for eg- long int will be given 4 bytes space in memory whereas int is of 2 bytes(in turbo c++). We can use these datatypes to make our program more precise which you will experience with time. There are Unary operators like -,++,-- in c++; ++ or -- operators are used to increment or decrement the value stored in a variable by one.These can be used be...
Image
Today we are going to discuss how to declare variables, what are cin,cout functions and we will also write a simple program to add two numbers and display it. The Syntax of declaring a variable is as follows- datatype vaiable name ; here,datatype can be int , float , char ,double ,  bool or void.(A variable of Bool datatype can store two possible values i.e. true or false,0 or 1,etc.).A variable name can be anything following the identifier's rules (discussed in previous posts).Every variable is associated with 2 values , r value and l value. r value is the datavalue and l value is the memory address of the variable. Example of variable declaration- float a; , int b; , etc. The variable declaration can be cascaded as follows if two or more variables have same datatypes. float a,b,c; Now,Coming towards the cin(console input) and cout(console output) operations. As the name suggests, cin (object of a class ifstream of iostream.h) and cout (object of a class ofstream o...
Hello Once Again Guys and Sorry for the delay. Now we are Going to continue where we left last time and you will get introduced to some new terms too. So we were at Literals, Let us remind it- Literals-A Literal is nothing But a token with Fixed Values.There are Mainly 5 types of Literals in C++ .They are- 1.Boolean Literal 2.Integer Literal 3.Character Literal 4.Float Literal 5.String Literal Now we will discuss these types a little bit. 1. Boolean Literal-It denotes a Logical expression which can only have two possible values ,0 or 1,true or false,yes or no,etc. 2. Integer Literal-As the name denotes,it can only take integer values(0-9) positive and negative.Its size depends on the Compiler but usually its around 2-4bytes. 3. Character Literal-It Stores Any Single character and the input must be given in Single Quotes. Every Character has its own Ascii code assigned to it. It's Size is usually 1 byte. 4. Float Literal-It has all the properties of an integer literal e...