#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<conio.h>
#include<stdio.h>
using namespace std;
struct Employee_str
{
char Name[25],status[15];
int anak,gaji;
char jmlh[2];
};
int main()
{
printf(" Nama : Muhammad husni \n");
printf(" ========================\n");
Employee_str employee[5];
int loop;
for(loop=1;loop<5;loop++)
{
cout<<"Karyawan (1, 2, 3, ..) : "<<endl;
cin.getline(employee[loop].jmlh,80.);
cout<<"Nama Karyawan "<<" : "<<endl;
cin.getline(employee[loop].Name,80.);
cout<<"Gaji/Bulan : "<<endl;
cin>>employee[loop].gaji;
cin.ignore(80);
cout<<"Status (Menikah/Belum Menikah) : "<<endl;
cin.getline(employee[loop].status,80.);
cout<<"Anak (0, / 1, 2, 3, ..) : "<<endl;
cin>>employee[loop].anak;
cin.ignore(80);
cout<<endl;
}
cout<<"Data Karyawan : "<<endl;
cout.flags(ios::left);
cout<<setw(0)<<"No "<<" Nama "<<" Gaji "<<" Status "<<" Anak"<<endl;
cout<<"================================================"<<endl;
for(loop=1;loop<5;loop++)
{
cout<<setiosflags(ios::left)<<setw(4)<<loop;
cout<<setiosflags(ios::left)<<setw(10)<<employee[loop].Name;
cout<<setiosflags(ios::left)<<setw(10)<<employee[loop].gaji;
cout<<setiosflags(ios::left)<<setw(20)<<employee[loop].status;
cout<<setiosflags(ios::left)<<setw(12)<<employee[loop].anak;
cout<<endl;
}
cout<<endl;
getch();
return 0;
}
Tidak ada komentar:
Posting Komentar