-->

WAP to input using cin.

// program to understand cin object in C++
#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
    system("cls");  // clears the screen
    int a,b;        //declaration of variables
    cout<<"enter values for a and b"<<endl;
    cin>>a>>b;// multiple inputs using 'get from' operator (>>). we can use in different line.
    cout<<"a="<<a<<" and b="<<b<<endl;// prints input values in same line with string literal. we can use different line.
    return 0;                         // it is also called chaining outputs/inputs
}

WAP to input

// program to understand cin object in C++
#include<iostream>
#inlcude<stdlib.h>
using namespace std;
int main()
{
    system("cls");
    int a,b;
    cout<<"enter values for a and b"<<endl;
    cin>>a>>b;
    cout<<"a="<<a<<"and b="<<b<<endl;
    return 0;
}

WAP to use header file with double quote.

//program to understand header file with double quote
#include "iostream"  //header file enclosed inside double quote
#include"stdlib"     // header file for system("cls")
using namespace std;
int main()
{

    cout << "Hello world!" << endl; // cout object with insertion operator/put to operator(<<)
    cout<<"this is second line"<<endl;
    return 0;
}

WAP to understand white space

//program to understand white space
#include <iostream>                 //header file
#include<stdlib.h>                  //header file
using namespace std;
int main()                          //main function
{
    cout << "Hello C++!" << endl;// string print with space called white space. It also can be tab/line feed
                                    //vertical tab or formfeeds etc.
    return 0;                       // returns 0 after execution
}

WAP to understand escape sequence.

//PROGRAM TO understand escape sequence

#include <iostream>//header file

using namespace std;//to handle all standard characters/functions,reserved words  used in program. we do not use in turboc++ compiler.

int main()          //main function
{
    cout << "first line"<<"\n";//escape sequence for new line
    cout<<"second line"<<"\n";//escape sequence for new line. we can also use single quote. It works.
    return 0;
}

WAP to understand endl manipulator

// program to understand endl manipulator
#include <iostream>  //header file
using namespace std; //to handle all standard characters/functions,reserved words  used in program. we do not use in turboc++ compiler

int main()
{
    cout<<"first line"<<endl;// cout is an object and is pre-defined. It is responsible for output stream.
                             // endl is used to feed a line in stream and is called manipulator. It works in same manner as \n does in program.
                            // we can put \n in single quote or double quote.
    cout << "second line\n";
    cout<<"third line"<<"\n"<<"or"<<endl;
    cout<<"fourth line"<<'\n';
    return 0;
}

c++ to print hello world

//program to print hello world    //comment line
#include <iostream>              // header file to handle input and output
#include<stdlib.h>               // header file to handle system(cls).
using namespace std;             //to handle all standard characters/functions,reserved words  used in program. we do not use in turboc++ compiler
int main()                       // main function as starting point of execution
{
    cout<<"firstline"<<endl;
    system("cls");                 //clears the screen
    cout << "Hello world!" << endl;// cout is an object and is pre-defined. It is responsible for output     // stream. endl is to end the line.
                                   //<< is called insertion operator or put -to operator.
    return 0;                       // the string inside double quote is string constant. Here it is "hello world".
}