All Projects

Bus Ticket Booking System in Python
Bus Ticket Booking System in Java
Bus Ticket Booking System in Cpp
Bus Ticket Booking System in C
Cafe Order System in Python
Cafe Order System in Java
Cafe Order System in Cpp
Cafe Order System in C
Social Media Account Details Manager in Python
Social Media Account Details Manager in Java
Social Media Account Details Manager in Cpp
Social Media Account Details Manager in C
Mini ATM in Python Language
Mini ATM in Java Language
Mini ATM in cpp language
Mini ATM in c language
Pocket Money Manager in Python Language
Pocket Money Manager in Java Language
Pocket Money Manager in Cpp Language
Pocket Money Manager in C Language
Username Password Generator in Python Language
Username Password Generator in Cpp Language
Username Password Generator in C Language
Telephone Directory in Python Language
Telephone Directory in Java Language
Telephone Directory in Cpp Language
Telephone Directory in C Language
Calander in Cpp Language
Calander in C Language
NoteBook in Python Language
NoteBook in Cpp Language
NoteBook in C Language
Voting System in Python Language
Voting System in Java Language
Voting System in Cpp Language
Voting System in C Language
Age Calculator in Python Language
Age Calculator in Java Language
Age Calculator in Cpp Language
Age Calculator in C Language
Currency Converter in Python Language
Currency Converter in Java Language
Currency Converter in Cpp Language
Currency Converter in C Language
Random Password Generator in python language
Random Password Generator in java language
Random Password Generator in cpp language
Random Password Generator in c language
Billing System in python language
Billing System in c++ language
Billing System in c language
Atm in c language

NoteBook in Cpp Language


Aniket The Programmer

1K+ Subscribers

Click To Subscribe My Channel

Subscribe

Source Code

        
#include <iostream>
#include <vector>
#include <string>

using namespace std;

//make all function

class Notebook {
private:
    vector<string> notes;

public:
    void addNote() {
        string newNote;
        cout << "Enter your note: ";
        getline(cin, newNote);
        notes.push_back(newNote);
        cout << "Note added successfully!" << endl;
    }

    void deleteNote() {
            if (notes.empty()) {
                cout << "No notes to delete." << endl;
                return;
            }

            int index;
            cout << "Enter the index of the note you want to delete (0-" << notes.size() - 1 << "): ";
            cin >> index;
            cin.ignore(); // Ignore the newline character from cin
            if (index >= 0 && index < notes.size()) {
                notes.erase(notes.begin() + index);
                cout << "Note deleted successfully!" << endl;
            } else {
                cout << "Invalid index entered." << endl;
            }
        }

    void displayNotes() {
        if (notes.empty()) {
            cout << "No notes available." << endl;
            return;
        }

        cout << "Your notes:" << endl;
        for (size_t i = 0; i < notes.size(); ++i) {
            cout << i << ": " << notes[i] << endl;
        }
    }
};


int main() {
    Notebook notebook;
    int choice;

    do {
        cout << "Notebook Menu:" << endl;
        cout << "1. Add a note" << endl;
        cout << "2. Delete a note" << endl;
        cout << "3. Display notes" << endl;
        cout << "4. Exit" << endl;
        cout << "Enter your choice: ";
        cin >> choice;
        cin.ignore(); // Ignore the newline character from cin

        switch (choice) {
            case 1:
                notebook.addNote();
                break;
            case 2:
                notebook.deleteNote();
                break;
            case 3:
                notebook.displayNotes();
                break;
            case 4:
                cout << "Exiting..." << endl;
                break;
            default:
                cout << "Invalid choice. Please enter a valid option." << endl;
        }
    } while (choice != 4);

    return 0;
}
        
    

Source Code Github Link: View

View Video On Youtube Link: View