I need some help with my menu

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;

int main()
{
int select;
int name;
int exit;
int newName;

cout << "Select an Option: " << endl;
cout << "1. Add Name to File." << endl;
cout << "2. Display Names on File." << endl;
cout << "3. Clear the File." << endl;
cout << "4. Exit the Program." << endl;
cout << "Selection: ";
cin >> select;
cout << endl;

if (select == 1)
{
ofstream outputFile;
string name;

outputFile.open("names.txt", ios::app);

cout << "Adding names to file." << endl;
cout << "Enter a name: ";
cin >> name;
while (name != 'done')
{
outputFile << name << endl;
cout << "Names added successfully!" << endl;
cout << "Add another name: ";
cin >> name;
}


outputFile.close();

system("pause");
return 0;
}
else if (select == 2)
{
ifstream inputFile;
string name;

inputFile.open("names.txt");
cout << "Names from the file names.txt: " << endl;
cout << endl;
while (inputFile >> name)
{
cout << name << endl;
}
cout << endl;
inputFile.close();
system("pause");
return 0;
}
else if (select == 3)
{
ofstream outputFile;
string name;

outputFile.open("names.txt");
cout << "All data cleared." << endl;

outputFile.close();

system("pause");
return 0;
}
else if (select == 4)
{
cout << "Goodbye" << endl;
return 0;
}
}
Topic archived. No new replies allowed.