In this program we will enter the record of employee and shows its output if the user wants.
The Code is given below.
//Code Starts
#include<iostream>
#include<conio.h>
using namespace std;
struct addr
{
char houseno[20];
char street[30];
char city[20];
char state[20];
};
struct emp
{
char
empno[10];
char
name[20];
char desig[20];
addr address;
float basic;
}worker;
int main()
{
emp evar;
cout<<"Employee
No: ";
gets(evar.empno);
gets(evar.name);
cout<<"Designation:
";
gets(evar.desig);
cout<<"House
No: ";
gets(evar.address.houseno);
cout<<"Street: ";
gets(evar.address.street);
cout<<"City:
";
gets(evar.address.city);
cout<<"State:
";
gets(evar.address.state);
cout<<"Basic
Pay: ";
cin>>evar.basic;
cout<<endl;
char ch;
cout<<"Want to see ? (y/n)...";
cin>>ch;
if(ch=='y'
|| ch=='Y')
{
cout<<"\nEmployee
Data:\n";
cout<<"Employee
No: "<<evar.empno;
cout<<"\nName:
"<<evar.name;
cout<<"\nDesignation: "<<evar.desig;
cout<<"\nAddress:
"<<evar.address.houseno<<", ";
cout<<evar.address.street<<", ";
cout<<evar.address.city<<",
";
cout<<evar.address.state<<endl;
cout<<"Basic Pay:
"<<evar.basic;
cout<<"\n";
}
getch();
}
//Code Ends
0 comments:
Post a Comment