├── .env ├── README.md ├── array_implementation_of_queue_using_c++ ├── manual.txt ├── nodemon.json └── package.json /.env: -------------------------------------------------------------------------------- 1 | MONGO_URL=mongodb+srv://ramanamurugan7:ramanA%40008@cluster0.peysdza.mongodb.net/ 2 | JWT_SECRET=any 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # database -------------------------------------------------------------------------------- /array_implementation_of_queue_using_c++: -------------------------------------------------------------------------------- 1 | #include // For using exit() 2 | 3 | using namespace std; // Allows us to avoid writing std::cout, std::cin, etc. 4 | 5 | class queue { 6 | int queue1[5]; // Fixed size queue 7 | int rear, front; // Rear and front pointers 8 | 9 | public: 10 | // Constructor initializes front and rear to -1 11 | queue() { 12 | rear = -1; 13 | front = -1; 14 | } 15 | 16 | // Insert element into the queue 17 | void insert(int x) { 18 | // Check for queue overflow 19 | if(rear >= 4) { // Fixed condition (rear >= 4 for 5 elements) 20 | cout << "Queue overflow\n"; 21 | front = rear = -1; // Reset the queue 22 | return; 23 | } 24 | queue1[++rear] = x; // Increment rear and insert the element 25 | cout << "Inserted " << x << endl; 26 | } 27 | 28 | // Delete element from the queue 29 | void delet() { 30 | // Check for queue underflow 31 | if(front == rear) { 32 | cout << "Queue underflow\n"; 33 | return; 34 | } 35 | cout << "Deleted " << queue1[++front] << endl; // Increment front and delete the element 36 | } 37 | 38 | // Display elements in the queue 39 | void display() { 40 | // If the queue is empty 41 | if(rear == front) { 42 | cout << "Queue is empty\n"; 43 | return; 44 | } 45 | // Loop through the queue to display elements 46 | for(int i = front + 1; i <= rear; i++) 47 | cout << queue1[i] << " "; 48 | cout << endl; 49 | } 50 | }; 51 | 52 | // Main function 53 | int main() { 54 | int ch; // Variable to store choice 55 | queue qu; // Create an object of the queue class 56 | 57 | // Infinite loop for menu-driven program 58 | while(1) { 59 | // Menu options 60 | cout << "\n1. Insert 2. Delete 3. Display 4. Exit\nEnter your choice: "; 61 | cin >> ch; 62 | 63 | // Switch-case for different choices 64 | switch(ch) { 65 | case 1: 66 | cout << "Enter the element to insert: "; 67 | cin >> ch; // Reusing 'ch' for the element to be inserted 68 | qu.insert(ch); // Insert the element 69 | break; 70 | case 2: 71 | qu.delet(); // Call delete function 72 | break; 73 | case 3: 74 | qu.display(); // Display the queue 75 | break; 76 | case 4: 77 | exit(0); // Exit the program 78 | default: 79 | cout << "Invalid choice. Please try again.\n"; // Handle invalid input 80 | } 81 | } 82 | 83 | return 0; 84 | } 85 | -------------------------------------------------------------------------------- /manual.txt: -------------------------------------------------------------------------------- 1 | cd client and then npm start 2 | parallely make second tereminal 3 | npx nodemon server/server -------------------------------------------------------------------------------- /nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "verbose": true, 3 | "ignore": ["./client"], 4 | "execMap": { 5 | "rb": "ruby", 6 | "pde": "processing --sketch={{pwd}} --run" 7 | } 8 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "project", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "author": "", 9 | "license": "ISC", 10 | "dependencies": { 11 | "bcryptjs": "^2.4.3", 12 | "dotenv": "^16.3.1", 13 | "express": "^4.18.2", 14 | "jsonwebtoken": "^9.0.2", 15 | "mongoose": "^7.5.0", 16 | "nodemon": "^3.0.1" 17 | }, 18 | "keywords": [], 19 | "description": "" 20 | } 21 | --------------------------------------------------------------------------------