Abstract Data Type In C++
Abstract Data type (ADT) is a type (or class) for objects
whose behaviour is defined by a set of value and a set of operations.
The definition of ADT only mentions what operations are to be
performed but not how these operations will be implemented. It does not specify
how data will be organized in memory and what algorithms will be used for
implementing the operations. It is called “abstract” because it gives an
implementation-independent view.
Fig: Abstract Data Type In C++
Program:
#include<iostream.h>
#include<conio.h>
struct emp
{
char name[10];
int age;
};
void main()
{
struct
emp e;
cout<<”enter
employee name \n”;
cin>>e.name;
cout<<”enter
age\n”;
cin>>e.age;
cout<<”name
is”<< “ “<<e.name;
cout<<”age
is “<<” ”<<e.age;
getch();
}
Output:
Enter
name Pramod
Enter
age 21
Name
is Pramod
Age
is 21
No comments:
Post a Comment