![]() |
VOOZH | about |
Databases are being used in every aspect of our lives right now. Trillions of bytes of data are being stored in servers around the world. SQL is one of the most basic methods to use such a database. But have you ever thought about using C++ to maintain such a database. In this post, we will talk about implementing different views on a text file according to the type of user and edit accordingly.
The data stored using this code are:
1) Registration number
2) Name
3) Marks in CSE1001
4) Marks in CSE1002
5) Proctor ID
Following code is a simple implementation of Student Management Project written in C++
Output:
Available operations: 1. Add New Students 2. Student Login 3. Faculty Login 4. Proctor Login 5. Admin View 6. Exit Enter option: 1 Enter the number of students: 2 Enter your registration number: 15BCE2083 Enter your name: Dheeraj Enter your proctor ID: 1001 Enter your registration number: 15BCE2082 Enter your name: Rohan Enter your proctor ID: 1002 Available operations: 1. Add New Students 2. Student Login 3. Faculty Login 4. Proctor Login 5. Admin View 6. Exit Enter option: 3 Enter your subject code: CSE1001 Available operations: 1. Add data about marks 2. View data Enter option: 1 Warning! You would need to add mark details for all the students! Enter the mark of student#1 : 52 Enter the mark of student#2 : 89 No such subject code found! Available operations: 1. Add New Students 2. Student Login 3. Faculty Login 4. Proctor Login 5. Admin View 6. Exit Enter option: 5 Enter the admin password: admin Reg No. Name CSE1001 CSE1002 Proctor ID 15BCE2083 Dheeraj 52 00 1001 15BCE2082 Rohan 89 00 1002 Available operations: 1. Add New Students 2. Student Login 3. Faculty Login 4. Proctor Login 5. Admin View 6. Exit Enter option: 6 ------------------ (program exited with code: 0) Press return to continue
Do note that I have set the pointer position according to the length of the data I am entering in the text file. Some of the things which I had assumed are the registration number is always 9 characters long, subject code is either CSE1001/CSE1002, proctor ID is 4 characters long, marks is just 2 characters long. You would need to change the code accordingly if you want to enter some other type of data.