Monday, 14 March 2016

C++ Program For Employee Information Using Nested Structure

Problem:- c++ program for employee details using class and object or c++ program to get and display employee details using class and object or c++ program for employee details using file or c program to generate employee details using structure or c++ program for employee details using array of objects or c++ program for employee details using constructor or c program using structures student details or c program for employee details using a nested structure.

Check This:- Hacker rank solution for Strings, Classes, STL, Inheritance in C++.

What Is Structure

The structure is a user-defined data type in C which allows you to combine different data types to store a particular type of record. The structure is used to represent a record. Suppose you want to store a record of Student which consists of student name, address, roll number and age.

Check This Program In C Language Click Here

Defining a structure

struct keyword is used to define a structure. struct define a new data type which is a collection of different type of data.

Syntax :

struct structure_name

{
//Statements
//Statements
//Statements
//Statements
};

Also Check:- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard in C++.
Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date.

Solution:-

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

//Ghanendra Yadav

struct Address
{
char HouseNo[25];
char City[25];
char PinCode[25];
};

struct Employee
{
int Id;
char Name[25];
float Salary;
struct Address Add;
};

int main()
{

int i;

Employee E;

cout << "\n\tEnter Employee Id : ";
cin >> E.Id;

cout << "\n\tEnter Employee Name : ";
cin >> E.Name;

cout << "\n\tEnter Employee Salary : ";
cin >> E.Salary;

cout << "\n\tEnter Employee House No : ";
cin >> E.Add.HouseNo;

cout << "\n\tEnter Employee City : ";
cin >> E.Add.City;

cout << "\n\tEnter Employee House No : ";
cin >> E.Add.PinCode;

cout << "\nDetails of Employees";

cout << "\n\tEmployee Id : " << E.Id;
cout << "\n\tEmployee Name : " << E.Name;
cout << "\n\tEmployee Salary : " << E.Salary;
cout << "\n\tEmployee House No : " << E.Add.HouseNo;
cout << "\n\tEmployee City : " << E.Add.City;
cout << "\n\tEmployee House No : " << E.Add.PinCode;

return 0;
}

Output:-



You May Also See


1. C Program For Bubble Sort In Ascending And Descending Order

2. C Program For Selection Sort In Ascending And Descending order

3. C Program For Insertion Sort In Ascending Order

4. C Program For QUICK Sort In Ascending Order

5. C Program For MERGE Sort In Ascending Order

6. C Program For HEAP Sort In Ascending Order Also Show Complexity

7.C Program For Given A Long Sentence Reverse The Sentence Word By Word.

8. C Program For Linear Search

9. C Program For Binary Search

10. C Program To Store Students Information of Using Structure In C


Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment