Pages

Thursday 12 March 2020

ABSTRACT DATA TYPE


Steps to run ABSTRACT DATA TYPE (ADT)

·        Name the program number(1) as add.c

·        Name the program number(2) as add.h

·        Name the program number(3) as add.app

·        .C file with calling function

·        .H file is with  function declaration

·        .App file is with called function

·        Now Compile Program Number(1)


Program Number (1): save this file has add.c
#include<stdio.h>
#include<conio.h>
#include"add.h"
#include"add.app"
void main()
{
int a,b;
clrscr ();
printf("enter any number");
scanf("%d %d",&a,&b);
add(a,b);    // calling function 
getch();
}

Program Number (2): save this file has add.h
void add (int,int);  // function declaration 

Program Number (3):save this file has add.app
#include "add.h"
void add (int a, int b)   // called function 
{
int tmp;
tmp=a+b;
printf("addition of two numbers is : %d",tmp);
}


No comments:

Post a Comment

Constructors & Destructors in c++

  Constructors :  A Constructor is a special member function, which is used to initialize the objects of its class. The Constructor is invok...