0% found this document useful (0 votes)
28 views1 page

Source Code: Perform Task 1 Using Pointer Structure

The document contains a C++ program that defines a structure for an Employee with attributes like ID, age, name, and salary. It uses a pointer to an Employee structure to input and display the employee's details. The program showcases how to manipulate structure data using pointers in C++.
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)
28 views1 page

Source Code: Perform Task 1 Using Pointer Structure

The document contains a C++ program that defines a structure for an Employee with attributes like ID, age, name, and salary. It uses a pointer to an Employee structure to input and display the employee's details. The program showcases how to manipulate structure data using pointers in C++.
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/ 1

Task 2

Perform Task 1 using pointer structure.


Source Code
#include<iostream>
#include<string>
using namespace std;

struct Employee
{
int empID, empAge;
string empName;
float empSalary;

};
int main()
{
Employee e1,*eptr;
eptr = &e1;
cout << "Enter Employee's name::" << endl;
/*cin >> e1.empName;*/
getline(cin, (*eptr).empName);
cout << "Enter Employee's age::\n";
cin >> (*eptr).empAge;
cout << "Enter Empolyee's ID::\n";
cin >> (*eptr).empID;
cout << "Enter Empoyee's Salary::\n";
cin >> (*eptr).empSalary;
system("cls");
cout << "Employee ID::" << endl << (*eptr).empID << endl;
cout << "Employee Name::" << endl << (*eptr).empName << endl;
cout << "Employee Age::" << endl << (*eptr).empAge << endl;
cout << "Employee Salary::" << endl << (*eptr).empSalary << endl;
system("pause");
return 0;
}

You might also like