this is my first program ever, my email address is in the program. tell me if anything is too complicated or there are bugs and if you can tell me how to fix them. this program is me playing with fstream and it writes to a txt file or creates a new one if it does not exist, it also allows you to read a file by typing the full path of the file or putting the text file into the same folder and just type out the file name.

keep in mind this is my first real program so be gentle kay?

First program? Really?

Function main( ) does not need a prototype.

Function haha( ) is quite clever, sort of. It's really a bit confusing to be calling this to keep the program looping through the options. What's going on is a growing pile of functions on the stack - like recursion, but harder to follow. Keep this up long enough and you'll probably crash the program.

Why not just put a loop in main( ) that continues till quit is chosen?

Clarity is important.

First program? Really?

Function main( ) does not need a prototype.

Function haha( ) is quite clever, sort of. It's really a bit confusing to be calling this to keep the program looping through the options. What's going on is a growing pile of functions on the stack - like recursion, but harder to follow. Keep this up long enough and you'll probably crash the program.

Why not just put a loop in main( ) that continues till quit is chosen?

Clarity is important.

ok thanks, I'll make that improvement. but what i wanted to avoid was the user having to go through the beginning prompt.

Put the intro outside the loop. More or less like this structure:

int main()
{
    string option;

    cout << "welcome to text editor, ...blah blah" << endl << endl;
    
     do
    {
        cout << "to read a text file, type read" << endl 
              << "to write to a text file type write" << endl
              << "to end program type quit" << endl;
         cin >> option;
    
        if (option == "write")
               write();
    
         else if (option == "read")
                read();

        else if ( option == "quit" )
                goodbye_msg( );
        else
                invalid_choice_msg( );
     }while ( option != "quit" );

      return 0;
}

Wow, a zig-zag flow of control.
But is definitely not a wow. Sit down with a pencil-paper and design a flow chart of your program.
The flow of program is not efficient.
main calls read/write which calls haha which can in turn call read/write and so on.
This is definitely not feasible.
Construct a loop as vmanes told you and remove the haha function.
Don't use system(). file.open(thing,ios::in|ios::out|ios::binary); Why did you opened in binary mode?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.