Just got finished working on the code and everything works perfectly just as it should. Thanks for all the help dasani885 , you helped me throughout the whole way and i really appreciate it. Here is all the code in all of its glory.
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
usingnamespace std;
int main()
{
char choice;
string filename, text;
ofstream f;
ifstream infile;
do{
int option;
cout << "***Menu***" << endl;
cout << "1.Create a File" << endl;
cout << "2.Display a File" << endl;
cout << "3.Edit a File" << endl;
cout << "4.Delete a File" << endl;
cin >> option;
switch (option)
{
case 1:
cout << "What would you like to name your file?" << endl;
cin >> filename;
f.open ( filename.c_str() );
f.close();
cout << "Successfully created: " << filename << endl;
break;
case 2:
cout << "What is the name of the file you would like to display?" << endl;
cin >> filename;
infile.open(filename.c_str());
if(!infile)
{
cout << "Unable to open file\n";
}
else
{
cout << "Reading file: " << filename << endl;
while (getline(infile,filename)){
cout << "This file says: " << filename << endl;
f.close();
}
}
break;
case 3:
cout << "What is the name of the file you would like to edit?" << endl;
cin >> filename;
f.open(filename.c_str(),ios::out | ios::in);
if (!infile)
{
cout << "unable to open file\n";
}
else
{
cout << "Found File...Opening..." << endl;
cout << "What would you like to write into this file?" << endl;
cin.ignore();
getline (cin,text);
f << text << endl;
f.close();
}
break;
case 4:
cout << "What is the name of the file you would like to delete?" << endl;
cin.ignore();
getline(cin,filename);
remove(filename.c_str());
cout << filename <<" has been removed."<<endl;
break;
default:
cout << "invalid entry" << endl;
}
cout<<"Would you like to continue? (Y/N)" <<endl;
cin >> choice;
}while(choice == 'y' || choice == 'Y');
return 0;
}