Text Editor Gaming Project in C++

Explanation

  1. Menu Display:
    • displayMenu(): This function shows the available options: creating a new file, opening an existing file, saving the current file, editing text, and exiting the program.
  2. File Operations:
    • Create a New File:
      • createNewFile(): This function prompts the user for a new file name and clears any existing content, preparing the editor for new input.
    • Open an Existing File:
      • openFile(): This function asks for a file name and attempts to open it. If successful, it reads the file’s content into the fileContent string.
    • Save the Current File:
      • saveFile(): This function writes the current content stored in fileContent to the file specified by fileName.
  3. Text Editing:
    • editText(): This function allows the user to enter text line by line. It appends each line to fileContent until the user types “SAVE,” which signals the end of editing.
  4. Main Function:
    • The main() function manages the text editor’s workflow. It continuously displays the menu, handles user input, and calls the appropriate functions based on the user’s choice.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top