Answer to Question #214036 in C++ for Hemambar

Question #214036

Write a program to create a file that contains employee and display the contents in a neatly

formatted manner.


1
Expert's answer
2021-07-17T10:42:09-0400


#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS