0% found this document useful (0 votes)
6 views2 pages

C++ 1

The document contains a C++ program that defines an 'employee' class with private attributes for name, age, and salary. It includes a method to input employee information and another to display it. The main function creates an instance of the employee class and calls the display method to show the entered details.

Uploaded by

SMARTY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

C++ 1

The document contains a C++ program that defines an 'employee' class with private attributes for name, age, and salary. It includes a method to input employee information and another to display it. The main function creates an instance of the employee class and calls the display method to show the entered details.

Uploaded by

SMARTY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Name :- Avinesh Padayachi

Roll no :- 2538
Class :- FYIT B

#include <iostream>

using namespace std;


class employee
{ int age; char
name[20];
float sal;

void getInfo ()
{
cout<<"Enter your name, age and salary:";
cin>>name>>age>>sal;
}
public:
void displayInfo ()
{ getInfo (); cout<<"\n your name , age and salary are :"<<name<<"\
n"<<age<<"\n"<<sal;
}
};
int main ()
{
employee e;
e.displayInfo();
return 0;

OUTPUT :-
Name :- Avinesh Padayachi
Roll no :- 2538
Class :- FYIT B

You might also like