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 except it store values in fractional form and its size is usually 4 bytes.
5. String Literal/Constants-It is Stream of Characters enclosed with double quotes and it automatically gets appended with a null byte('/0') at the end of string to recognize the end of the string. Its size is Number of Characters + 1 byte(for null byte).
There are Also Escape sequence Characters which are characters with predefined operations.eg-'\t'-for tabspace,'\n'-for new line,etc.
We also discussed Variables which store data in memory depending upon the datatype given.
Now Question is 'What is a Datatype'?
The Datatype sets the type of data that can be stored and used to perform different operations in a particular/reffered memory space.
There are mainly five Datatypes in c++-
1. int (perform features of integer literal).
2. char (perform features of character literal).
3. float (perform features of float literal).
4. double (Has same features as float but has bigger range of numbers).
5. void (It's empty-no values,no operations).
Also there are Five basic Arithematic Operators in c++-+ ,- ,* ,/ ,% (for remainder).
I you are not very much clear with what we have discussed so far, Don't worry as your doubts will start getting clear as we move towards real programming and you will get to know more when you get your hands dirty(It doesn't mean getting your hands dirty in real or being unhygeinic).
Next time we will Discuss the declaration of variables and some related topics so be ready.
To conclude for today I would like to tell you little bit about the header file(iostream) and namespace
which we used in our first Hello World Program.
A Preprocessor Directive starting with a # sign tell the compiler to include some files/attach some files to the program or set some changes for the program before compilation.iostream is also such a header file attached to the program which include predined input-output stream functions,macros etc.
Here include is also a keyword which,you know what it does.
Namespace-There is a using directive that tells the compiler where to look for names in library which have been organised to make it easier to write a program. These names are called namespaces and reffered by the abbreviation of the name given to them.eg- std refers to the standard library and using it in the program can be done using namespaces.
So,this is for today.Hope you get to learn something and you could ask your problems in comments below. Keep Learning.
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 except it store values in fractional form and its size is usually 4 bytes.
5. String Literal/Constants-It is Stream of Characters enclosed with double quotes and it automatically gets appended with a null byte('/0') at the end of string to recognize the end of the string. Its size is Number of Characters + 1 byte(for null byte).
We also discussed Variables which store data in memory depending upon the datatype given.
Now Question is 'What is a Datatype'?
The Datatype sets the type of data that can be stored and used to perform different operations in a particular/reffered memory space.
There are mainly five Datatypes in c++-
1. int (perform features of integer literal).
2. char (perform features of character literal).
3. float (perform features of float literal).
4. double (Has same features as float but has bigger range of numbers).
5. void (It's empty-no values,no operations).
Also there are Five basic Arithematic Operators in c++-+ ,- ,* ,/ ,% (for remainder).
I you are not very much clear with what we have discussed so far, Don't worry as your doubts will start getting clear as we move towards real programming and you will get to know more when you get your hands dirty(It doesn't mean getting your hands dirty in real or being unhygeinic).
Next time we will Discuss the declaration of variables and some related topics so be ready.
To conclude for today I would like to tell you little bit about the header file(iostream) and namespace
which we used in our first Hello World Program.
A Preprocessor Directive starting with a # sign tell the compiler to include some files/attach some files to the program or set some changes for the program before compilation.iostream is also such a header file attached to the program which include predined input-output stream functions,macros etc.
Here include is also a keyword which,you know what it does.
Namespace-There is a using directive that tells the compiler where to look for names in library which have been organised to make it easier to write a program. These names are called namespaces and reffered by the abbreviation of the name given to them.eg- std refers to the standard library and using it in the program can be done using namespaces.
So,this is for today.Hope you get to learn something and you could ask your problems in comments below. Keep Learning.
Comments
Post a Comment