-->

WAP to understand unary operator(prefix and postfix).

//program to understand prefix and postfix operator
#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
{
    int a=4,b;
    cout << "++a="<<++a << endl;//gives 5. It means first increase the value then use that. Its increased part (a=a+1) is invisible.
    a=4;
    cout<<"a++="<<a++;//gives 4. It means first use the value then increase the value. Its increased part is excuted after this statement and is not shown here.
                     // ++ is called increment operator. It can be prefix (++a)or postfix(a++).
    b=5;
   cout << "--a="<<--a << endl;//gives 4. It means first decrease the value then use that. Its decreased part (a=a-1) is invisible.
                    //-- is called decrement operator. It can be prefix(--a) and postfix(a--).
    b=5;
    cout<<"a--="<<a--;//gives 5. It means first use the value then decrease the value. Its decreased part is executed after this statement and is not shown here.
    return 0;
}

WAP to understand arithmetic remainder operator.

//program to understand remainder operator(modulus operator)

#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 << "remainder, when divided 5 by 7, is " <<5%7<<endl;
    return 0;
}

WAP to understand define directive or symbolic constant.

//program to understand define directive or symbolic constant
#include <iostream>//header file
#define name "RAM KUMAR KARKI"  //  defining symbolic constant for name
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 << "name="<<name << endl;//prints the name. Similarly we can also put numeric value.
    return 0;                       //returns zero value
}

WAP to understand const identifier

//program to understand const identifier

#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
{
    const int a=90;         //declaration of variable with constant value
   // a=8;                // not allowed here; because const identifier
    cout << "value of a(constant)="<<a << endl;
    return 0;
}

WAP to understand assignment operator.

//program to understand assignment operator with contracted/condensed approach

#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
{
    int a;              //declaration
    a=56;               //value assignment
    cout << "the value of a=" <<a<< endl;//prints the value
    a+=4;                      //condensed method. it means a=a+4.
    cout<<"after adding 4 to 56, it is  "<<a;// prints the value after adding 4.
    return 0;
}

WAP to understand type casting.

// program to understand type conversion
#include <iostream>
#include<stdlib.h>   // to handle system("cls")
using namespace std;
int main()
{
    system("cls");
    int a;
    int b;
    float result;
    cout<<"a and b="<<endl;
    cin>>a>>b;              //multiple inputs using >> operator called 'extraction' or 'get from' operator. 'cin' is an object.
    result=(a*b)/2;        // type casting takes place. It is implicit.
    cout<<"implicit result ="<<result<<endl;// gives result 8 if we input 1 and 17.
    result=float(a*b)/2;    // type casting takes place (Explicit).
    cout << "explicit result=" <<result<< endl;//gives result= 8.5 if we input 1 and 17
    return 0;
}

WAP to understand library function.

//program to understand library function
#include <iostream>// header file
#include<cmath>     // header file to handle mathematical functions
using namespace std;//to handle all standard characters/functions,reserved words  used in program. we do not use in turboc++ compiler
int main()
{
    double number,number_square;// declaration of variables
    cout << "enter a number" << endl;// input message
    cin>>number;                    // accepts input
    number_square=pow(number,2);    // finds square and stores in variable
    cout<<"square ="<<number_square;// prints output.
    return 0;
}