Program to illustrate Function

  /*  Program to illustrate Function  */  
   
      #include<iostream.h>
      #include<conio.h>

    void function1 ( )
    {
        cout<<"\n I am in function1 ……";
    }
    void function2 ( )
    {
        cout<<"\n I am in function2 ……";
    }

    void function3 ( )
    {
        cout<<"\n I am in function3 ……";
    }
       void main( )
    { 
        cout<<"\n I am in main ……";
        function1 ( ) ;
        function2 ( ) ;
        function3 ( ) ;
        getch ( );
    }   
--------------------------------------------

/*  Program to illustrate Function  */
#include<iostream.h>
#include<conio.h>

void function3()
{
    cout<<"\n I am in function3 ……";
}


void function2()
{
    cout<<"\n I am in function2 ……";
    function3( );
}

void function1()
{
    cout<<"\n I am in function1 ……";
    function2();
    cout<<"\n I am back in function1 ……";
}


void main( )
{
    cout<<"\n I am in main ……";
    function1() ;
    cout<<"\n I am back in main ……";
    getch();
}

No comments:

Post a Comment