Code Monkey home page Code Monkey logo

okdotdev / mini-console-data-base-in-cpp Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 9 KB

This program allows you to manage a database of persons. You can add new persons, view existing persons, save the database to a file, load the database from a file, search for persons by index, and delete persons from the database. ๐Ÿ—ƒ๏ธ

CMake 3.88% C++ 96.12%
beginner-code beginner-friendly beginner-project beginners cpp cpp-programming cpp-project database

mini-console-data-base-in-cpp's Introduction

Person Database ๐Ÿ‘ฅ

This program allows you to manage a database of persons. You can add new persons, view existing persons, save the database to a file, load the database from a file, search for persons by index, and delete persons from the database. ๐Ÿ—ƒ๏ธ

Prerequisites ๐Ÿ“

To run this program, you need to have a C++ compiler installed on your system. The program uses standard C++ libraries and does not require any additional dependencies. โš™๏ธ

Usage ๐Ÿ’ป

  1. Compile the program using a C++ compiler. For example, you can use the following command with g++: ๐Ÿ› ๏ธ
g++ -o persondb main.cpp
  1. Run the compiled program: โ–ถ๏ธ
./persondb
  1. Follow the menu options to perform various operations on the person database. ๐Ÿ“‹

Menu Options ๐Ÿ“‘

The program provides the following menu options:

  1. Add person: Allows you to add a new person to the database. You need to provide the person's name, surname, age, and phone number. โž•

  2. Show persons: Displays all the persons in the database. It shows the person's index, name, surname, age, and phone number. ๐Ÿ‘€

  3. Save Database to file: Saves the current state of the person database to a file named dataBase.txt. ๐Ÿ’พ

  4. Load Database from file: Loads the person database from the dataBase.txt file. Any existing data in the database will be replaced. ๐Ÿ“ฅ

  5. Search Database from database buffer: Displays person of choosen index.

  6. Delete person from database: Allows you to delete a person from the database based on their index. You need to provide the index of the person you want to delete. โŒ

Data Storage ๐Ÿ“

The person database is stored in memory using a vector of Person objects. Each Person object contains the following information:

ID: An automatically assigned unique identifier for the person. Name: The person's name. Surname: The person's surname. Age: The person's age. Phone number: The person's phone number.

File Storage ๐Ÿ’พ

The person database can be saved to and loaded from a file named dataBase.txt. The file format is as follows:

<number of persons>
<name>
<surname>
<age>
<phone number>

Each person's information is stored sequentially, with each field on a separate line. The number of persons in the database is stored at the beginning of the file.

Note โ„น๏ธ

When deleting a person, the program saves the updated database to the file automatically. The program expects the database file to be present in the same directory as the program executable. If the file is not found, an error message will be displayed. Feel free to modify and extend this program according to your needs. ๐Ÿ› ๏ธ

mini-console-data-base-in-cpp's People

Contributors

ily3s avatar okdotdev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.