diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..05054c5 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: g++ build active file", + "command": "/usr/bin/g++", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/C++/ReverseLinkedList.cpp b/C++/ReverseLinkedList.cpp deleted file mode 100644 index 8b13789..0000000 --- a/C++/ReverseLinkedList.cpp +++ /dev/null @@ -1 +0,0 @@ - diff --git a/C++/circularQueue b/C++/circularQueue new file mode 100755 index 0000000..6a8b36e Binary files /dev/null and b/C++/circularQueue differ diff --git a/C++/circularQueue.cpp b/C++/circularQueue.cpp new file mode 100644 index 0000000..20f463f --- /dev/null +++ b/C++/circularQueue.cpp @@ -0,0 +1,86 @@ +#include +using namespace std; + +const int MAX_SIZE = 5; // Maximum size of the queue + +class CircularQueue { +private: + int front, rear; + int arr[MAX_SIZE]; + +public: + CircularQueue() { + front = rear = -1; + } + + // check if the queue is empty + bool isEmpty() { + return (front == -1 && rear == -1); + } + + // check if the queue is full + bool isFull() { + return (front == (rear + 1) % MAX_SIZE); + } + + // enqueue an element + void enqueue(int value) { + if (isFull()) { + cout << "Queue is full. Cannot enqueue." << endl; + return; + } + if (isEmpty()) { + front = rear = 0; // + } else { + rear = (rear + 1) % MAX_SIZE; // Circular increment of rear + } + arr[rear] = value; + cout << value << " enqueued to the queue." << endl; + } + + // dequeue an element + void dequeue() { + if (isEmpty()) { + cout << "Queue is empty. Cannot dequeue." << endl; + return; + } + cout << arr[front] << " dequeued from the queue." << endl; + if (front == rear) { + front = rear = -1; + } else { + front = (front + 1) % MAX_SIZE; // Circular increment of front + } + } + + // display the elements of the queue + void display() { + if (isEmpty()) { + cout << "Queue is empty." << endl; + return; + } + cout << "Elements in the queue: "; + int i = front; + while (true) { + cout << arr[i] << " "; + if (i == rear) + break; + i = (i + 1) % MAX_SIZE; // Circular increment of index + } + cout << endl; + } +}; + +int main() { + CircularQueue queue; + queue.enqueue(1); + queue.enqueue(2); + queue.enqueue(3); + queue.display(); + queue.dequeue(); + queue.display(); + queue.enqueue(4); + queue.enqueue(5); + queue.display(); + queue.enqueue(6); // This will show an error as the queue is full. + return 0; +} diff --git a/C++/reverseLinkedList b/C++/reverseLinkedList new file mode 100755 index 0000000..cc26231 Binary files /dev/null and b/C++/reverseLinkedList differ diff --git a/C++/reverseLinkedList.cpp b/C++/reverseLinkedList.cpp new file mode 100644 index 0000000..7a61b41 --- /dev/null +++ b/C++/reverseLinkedList.cpp @@ -0,0 +1,78 @@ +#include + +using namespace std; + + +class Node { +public: + int data; + Node* next; + + Node(int val) { + data = val; + next = nullptr; + } +}; + + +class LinkedList { +public: + Node* head; + + + LinkedList() { + head = nullptr; + } + + // insert a new element at the beginning of the linked list. + void insert(int val) { + Node* newNode = new Node(val); + newNode->next = head; + head = newNode; + } + + // display the linked list elements. + void display() { + Node* current = head; + while (current != nullptr) { + cout << current->data << " -> "; + current = current->next; + } + cout << "nullptr" << endl; + } + + // reverse the linked list. + void reverse() { + Node* prev = nullptr; + Node* current = head; + Node* nextNode = nullptr; + + // Traverse the list + while (current != nullptr) { + nextNode = current->next; + current->next = prev; + prev = current; + current = nextNode; + } + + head = prev; // Set the new head. + } +}; + +int main() { + LinkedList list; + list.insert(1); + list.insert(2); + list.insert(3); + list.insert(4); + + cout << "Original Linked List: "; + list.display(); + + list.reverse(); + + cout << "Reversed Linked List: "; + list.display(); + + return 0; +} diff --git a/C++/stackOperations b/C++/stackOperations new file mode 100755 index 0000000..0853ed9 Binary files /dev/null and b/C++/stackOperations differ diff --git a/C++/stackOperations.cpp b/C++/stackOperations.cpp new file mode 100644 index 0000000..f216739 --- /dev/null +++ b/C++/stackOperations.cpp @@ -0,0 +1,55 @@ +#include +#include + +using namespace std; // Add this line to use the std namespace + +class Stack { +private: + vector stack; + +public: + void push(int value) { + stack.push_back(value); + } + + void pop() { + if (!isEmpty()) { + stack.pop_back(); + } else { + cout << "Stack is empty. Cannot pop." << endl; + } + } + + int top() { + if (!isEmpty()) { + return stack.back(); + } else { + cout << "Stack is empty. No top element." << endl; + return -1; // Return a default value indicating an empty stack. + } + } + + bool isEmpty() { + return stack.empty(); + } +}; + +int main() { + Stack myStack; + + myStack.push(10); + myStack.push(20); + myStack.push(30); + + cout << "Top element: " << myStack.top() << endl; + + myStack.pop(); + myStack.pop(); + + cout << "Top element after pops: " << myStack.top() << endl; + + myStack.pop(); + myStack.pop(); // Trying pop from an empty stack + + return 0; +} diff --git a/CodeRich Website/images/hero-bg.png b/CodeRich Website/images/hero-bg.png new file mode 100644 index 0000000..dc60fef Binary files /dev/null and b/CodeRich Website/images/hero-bg.png differ diff --git a/CodeRich Website/index.html b/CodeRich Website/index.html new file mode 100644 index 0000000..05f8153 --- /dev/null +++ b/CodeRich Website/index.html @@ -0,0 +1,48 @@ + + + + + + + CodeRich Community + + + +
+ +
+
+
+

E-Learning Platform

+

+ "Embark on an exciting programming journey to bring your ideas to life. Discover limitless possibilities as you master the art of coding and play a pivotal role in shaping our digital future." +

+ +
+
+ hero image +
+
+ + \ No newline at end of file diff --git a/CodeRich Website/style.css b/CodeRich Website/style.css new file mode 100644 index 0000000..d6e63e8 --- /dev/null +++ b/CodeRich Website/style.css @@ -0,0 +1,199 @@ +/* Importing Google font - Open Sans */ +@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&display=swap"); + +* { + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: "Open Sans", sans-serif; +} + +body { + height: 100vh; + width: 100%; + background: linear-gradient(to bottom, #246b7b 23%, #432a82 95%); + +} + +.header { + position: fixed; + top: 0; + left: 0; + width: 100%; +} + +.navbar { + display: flex; + align-items: center; + justify-content: space-between; + max-width: 1200px; + margin: 0 auto; + padding: 20px 15px; +} + +.navbar .logo a { + font-size: 1.8rem; + text-decoration: none; + color: #fff; +} + +.navbar .links { + display: flex; + align-items: center; + list-style: none; + gap: 35px; +} + +.navbar .links a { + font-weight: 500; + text-decoration: none; + color: #fff; + padding: 10px 0; + transition: 0.2s ease; +} + +.navbar .links a:hover { + color: #47b2e4; +} + +.navbar .buttons a { + text-decoration: none; + color: #fff; + font-size: 1rem; + padding: 15px 0; + transition: 0.2s ease; +} + +.navbar .buttons a:not(:last-child) { + margin-right: 30px; +} + +.navbar .buttons .signin:hover { + color: #47b2e4; +} + +.navbar .buttons .signup { + border: 1px solid #fff; + padding: 10px 20px; + border-radius: 0.375rem; + text-align: center; + transition: 0.2s ease; +} + +.navbar .buttons .signup:hover { + background-color: #47b2e4; + color: #fff; +} + +.hero-section { + display: flex; + justify-content: space-evenly; + align-items: center; + height: 95vh; + padding: 0 15px; + max-width: 1200px; + margin: 0 auto; +} + +.hero-section .hero { + max-width: 50%; + color: #fff; +} + +.hero h2 { + font-size: 2.5rem; + margin-bottom: 20px; +} + +.hero p { + font-size: 1.2rem; + margin-bottom: 20px; + color: #c9c7c7; +} + +.hero-section .img img { + width: 517px; +} + +.hero-section .buttons { + margin-top: 40px; +} + +.hero-section .buttons a { + text-decoration: none; + color: #fff; + padding: 12px 24px; + border-radius: 0.375rem; + font-weight: 600; + transition: 0.2s ease; + display: inline-block; +} + +.hero-section .buttons a:not(:last-child) { + margin-right: 15px; +} + +.buttons .join { + background-color: #47b2e4; +} + +.hero-section .buttons .learn { + border: 1px solid #fff; + border-radius: 0.375rem; +} + +.hero-section .buttons a:hover { + background-color: #47b2e4; +} + +/* Hamburger menu styles */ +#menu-toggle { + display: none; +} + +#hamburger-btn { + font-size: 1.8rem; + color: #fff; + cursor: pointer; + display: none; + order: 1; +} + +@media screen and (max-width: 1023px) { + .navbar .logo a { + font-size: 1.5rem; + } + + .links { + position: fixed; + left: -100%; + top: 75px; + width: 100%; + height: 100vh; + padding-top: 50px; + background: #175d69; + flex-direction: column; + transition: 0.3s ease; + } + + .navbar #menu-toggle:checked ~ .links { + left: 0; + } + + .navbar #hamburger-btn { + display: block; + } + + .header .buttons { + display: none; + } + + .hero-section .hero { + max-width: 100%; + text-align: center; + } + + .hero-section img { + display: none; + } +} diff --git a/index.html b/index.html deleted file mode 100644 index 1e0909e..0000000 --- a/index.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - 404 Error - Page Not Found - - - -
-

404

-

Page Not Found

- 404 Error Image -
- - - diff --git a/style.css b/style.css deleted file mode 100644 index 8b13789..0000000 --- a/style.css +++ /dev/null @@ -1 +0,0 @@ -