Ticker

6/recent/ticker-posts

WHAT IS C++ | A SIMPLE C++ PROGRAM

WHAT IS C++

  • C++ is an object oriented programming language developed by Biarne stroustrup at AT & T Bell laboratories. 
  • C++ is an extension of c with a major addition of the class construct feature.

A SIMPLE C++ PROGRAM

# include<iostream.h>

int main() 

    cout<<ìHello Woldî; 

    return 0; 

  • C++ program is a collection of functions. Every C++ program must have a main() function. 
  • The iostream file:- The header file iostream should be included at the beginning of all programs that uses one output statement.
  • Input / Output operator
    • Input Operator cin :- The identifier cin is a predefined object in c++ that corresponds to the standard input stream. Here this stream represents keyboard. 
    Syntax:- cin>>variable;
    • The operator >> is known as extraction or get from operator & assigns it to the variable on its right. 
    • 2. Output operator cout :-The identifier cout is predefined object that represents the standard output stream in c++. Here standard output stream represents the screen. 
    Syntax:- cout<<string;
    • The operator << is called the insertion or put to operator. It inserts the contents of the variable on its right to the object on its left. 
    • 3. Return type of main():- In C++, main returns an integer type value to the operating system. So return type for main() is explicitly specified as int. Therefore every main() in c++ should end with a return 0 statement.