Create your own header file...in 5 simple steps.
Today i will teach you how to create your own header file in turbo c or c++ application,
Now suppose , i want to create header file with the name of " somesh.h "
STEP 1-
open turbo c or c++ application.
STEP 2-
go to file then new
STEP 3-
#ifndef __somesh_h {name of your header file like somesh}
#define __somesh_h
{now define any function}
int add(int a, int b)
{ cout <<"enter the two numbers";
cin>>a>>b;
int sum =a+b;
cout<<"sum="<<sum;
return 0;
}
STEP 4-
now, save this with any name...as i save it as " somesh.h " ( you can use any name insted of somesh)
and copy the file ...go to TC folder in C drive inside TC folder you see an INCLUDE FLODER
inside INCLUDE FOLDER paste your headder file ("somesh.h")
STEP 5-
to use your header file..
#include"somesh.h" //your header file name
#include<stdio.h>
#include<conio.h>
void main( )
{
int x,y,z;
clrscr( );
cout<<"enter two numbers";
cin>>x>>y;
z=sum(x,y);
cout<<("sum is %d",c); //change code accordingly to your program
getch( );
}
***COMPILE & EXECUTE THE PROGRAM & ENJOY THE PROGRAMMING***
FOLLOW THIS BLOG ON FACEBOOK FOR MORE UPDATES : https://www.facebook.com/hackersrocks
No comments:
Post a Comment