C++ Very Short Revising Notes | IndianTechnoEra - IndianTechnoEra
Latest update Android YouTube

C++ Very Short Revising Notes | IndianTechnoEra

it2edu, c++, cpp, variable in c++, data type in c++, cin,cout,endl
Admin

 C++ Programming

C++ Very Short Revising Notes | IndianTechnoEra 

C++ is an object-oriented programming language. It is an extension of C programming.

What is C++?

C++ is a general-purpose, case-sensitive, free-form programming language that supports object-oriented, procedural, and generic programming.

Use of C++

  • i.) Windows application
  • ii.) Client-server application
  • iii.) Device drives
  • iv.) Embedded firmware etc.

Syntac of C++ Programming

#include<isostream>
using namespace std;
int main(){
    cout<<"C++ programming".
Standared output stream (cotn)

Standard outpu stream 'cout'

The 'cout' is a predefined object of ostream class. It is connected with a standard output device which is usually a display screen. It is denoted by '<<'.

Standard input stream 'cin'

  • The 'cin' is a predefined object of istream class. It is connected with a standard input device which is usually a keyboard. It is denoted by '>>'.
  • Standard endl line
  • The endl is a predefined object of the ostream class. It is used to insert a new line of characters.

Header File 'iostream'

It is used to define the cout, cin, and cerr objects which is correcpond to standard inutput stream, standard input stream, standard error steam respectively.

#include<iostream>
using namespace std;
int main(){
int name;
cout<<"Enter Your Name: ";
cin>>name;
cout<<"Your Name is ";<<name<<;
endl;
}

Note: Just consider the following points;

  • Use a semicolon (;)at every end line.
  • Put your text between double inverted commas ("text").
  • Use endl; for end of the line or to start a new line.

Data Type

A data type specifies the type of data that a variable can store such as integer, floating, character, etc. There are the following types of Data Types:
  • i.) Basic Data Type: int, char, float, double, etc.
  • ii.) Derived Data Type: Array, Pointer, etc.
  • iii.) User-Defined Data Type: Strucutre
  • iv.) Enumeration Data Type: enum

Type Name 32 Bit 64 Bit
Char 1 byte 1 byte
Short 2 byte 2 byte
Int 4 byte 4 byte
Long 4 byte 8 byte


Variable

  • It is the name of a memory location. It is used to store data. 
  • Its value can be changed and it can be reused many times.
  • It is a very to represent memory location, through symbol so that it can be easily identified.

Syntax to declare a variable:         type variablename;

Example:

Declare a variable Initiation of variable
int x;int x=5;
float y;float y=30.5;
char z;char z="A";

Rules to define variables:

  • i.) A variable can have alphabets, digits, and underscore.
  • ii.) A variable name can start with the alphabet and underscore only. It can't start with a digit.
  • iii.) No white space is allowed with this.
  • iv.) It cant start with a number.

Example:                        

Valid variable name Invalid variable name
int a; int 4;
int ab; int x y;
int a20; int double;

Post a Comment

Feel free to ask your query...
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.