#include <iostream>
#include <string>
using namespace std;

// Structure to simulate a directory
struct Directory {
    string dirName;
    string files[10];
    int fcnt;
};

int main() {
    Directory dir;
    dir.fcnt = 0;
    string f;
    int ch;

    cout << "Baladepak\n";
    cout << "Enter name of directory: ";
    cin >> dir.dirName;

    while (true) {
        cout << "\n\n1. Create File\t2. Delete File\t3. Search File\n"
             << "4. Display Files\t5. Exit\nEnter your choice: ";
        cin >> ch;

        switch (ch) {
        case 1:  // Create file
            if (dir.fcnt >= 10) {
                cout << "Directory full!" << endl;
            } else {
                cout << "\nEnter the name of the file: ";
                cin >> dir.files[dir.fcnt];
                dir.fcnt++;
            }
            break;

        case 2:  // Delete file
            cout << "\nEnter the name of the file to delete: ";
            cin >> f;
            {
                int i;
                for (i = 0; i < dir.fcnt; i++) {
                    if (dir.files[i] == f) {
                        cout << f << " is deleted" << endl;
                        dir.files[i] = dir.files[dir.fcnt - 1]; // Replace with last
                        dir.fcnt--;
                        break;
                    }
                }
                if (i == dir.fcnt) {
                    cout << f << " not found" << endl;
                }
            }
            break;

        case 3:  // Search file
            cout << "\nEnter the name of the file to search: ";
            cin >> f;
            {
                int i;
                for (i = 0; i < dir.fcnt; i++) {
                    if (dir.files[i] == f) {
                        cout << f << " is found" << endl;
                        break;
                    }
                }
                if (i == dir.fcnt) {
                    cout << f << " not found" << endl;
                }
            }
            break;

        case 4:  // Display files
            if (dir.fcnt == 0) {
                cout << "\nDirectory Empty" << endl;
            } else {
                cout << "\nThe Files are:\n";
                for (int i = 0; i < dir.fcnt; i++) {
                    cout << dir.files[i] << endl;
                }
            }
            break;

        case 5:  // Exit
            return 0;

        default:
            cout << "Invalid choice!" << endl;
        }
    }

    return 0;
}