Write a program to create a file that contains employee and display the contents in a neatly
formatted manner.
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream out ("Employee.text");
int n;
cout<<"Enter number of Employees:";
cin>>n;
string name;
for (int i=1;i<=n;i++){
cout<<"Enter name of Employee "<<i<<": ";
cin>>name;
out<<i<<". "<<name<<endl;
}
out.close();
return 0;
}
Comments
Leave a comment