Functions in C++ programming are used to divide a large program into sub-programs for easy control. All these sub-programs are called sub-functions of the program.
#include<iostream.h>
#include<conio.h>
void main()
{
void fun(); //defining Function 'fun()' for use, 'void' is must here.
fun(); //calling 'fun()' function.
cout<<"After Calling Function";
getch();
}
void fun() //this is 'fun()' function, 'void' is must here.
{
cout<<"This is Function"<<endl;
}
#include<iostream.h>
#include<conio.h>
void fun(); //defining Function 'fun()' for use, 'void' is must here.
void fun() //this is 'fun()' function, 'void' is must here.
{
cout<<"This is Function"<<endl;
}
void main()
{
fun(); //calling 'fun()' function.
cout<<"After Calling Function";
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
void fun(); //defining Function 'fun()'.
void fun2(); //defining Function 'fun2()'.
void fun3(); //defining Function 'fun3()'.
fun2(); //calling 'fun2()' function.
fun3(); //calling 'fun3()' function.
fun(); //calling 'fun()' function.
cout<<"After Calling Functions";;
getch();
}
void fun3() //this is 'fun3()' function.
{
cout<<"This is fun3() Function"<<endl;
}
void fun() //this is 'fun()' function.
{
cout<<"This is fun() Function"<<endl;
}
void fun2() //this is 'fun2()' function.
{
cout<<"This is fun2() Function"<<endl;
}