From a3034d759e51d841d5ce31db8749d5ce95069a03 Mon Sep 17 00:00:00 2001 From: Jose Langarica Date: Tue, 28 Feb 2023 21:22:48 +0700 Subject: [PATCH 1/3] Add files via upload added simple LinkedList.cpp --- data-structures/linkedList.cpp | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 data-structures/linkedList.cpp diff --git a/data-structures/linkedList.cpp b/data-structures/linkedList.cpp new file mode 100644 index 00000000..33ef17bc --- /dev/null +++ b/data-structures/linkedList.cpp @@ -0,0 +1,56 @@ +#include + +using namespace std; + +class Node { +public: + int data; + Node* next; + + Node(int data) { + this->data = data; + this->next = NULL; + } +}; + +class LinkedList { +public: + Node* head; + + LinkedList() { + this->head = NULL; + } + + void addNode(int data) { + Node* newNode = new Node(data); + if (this->head == NULL) { + this->head = newNode; + return; + } + Node* currentNode = this->head; + while (currentNode->next != NULL) { + currentNode = currentNode->next; + } + currentNode->next = newNode; + } + + void printList() { + Node* currentNode = this->head; + while (currentNode != NULL) { + cout << currentNode->data << " "; + currentNode = currentNode->next; + } + cout << endl; + } +}; + +int main() { + LinkedList list; + list.addNode(1); + list.addNode(2); + list.addNode(3); + list.addNode(4); + list.addNode(5); + list.printList(); + return 0; +} \ No newline at end of file From e5c1ce903586a7e39480fd0c4ba72200e9535a98 Mon Sep 17 00:00:00 2001 From: Alex Stan <90788596+Ultra980@users.noreply.github.com> Date: Sun, 15 Oct 2023 22:13:15 +0300 Subject: [PATCH 2/3] Create vowel_counter.cpp --- algorithms/strings/vowel_counter.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 algorithms/strings/vowel_counter.cpp diff --git a/algorithms/strings/vowel_counter.cpp b/algorithms/strings/vowel_counter.cpp new file mode 100644 index 00000000..4dca0389 --- /dev/null +++ b/algorithms/strings/vowel_counter.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; + +int main() { + string s; + int cnt; + cout << "Enter the string: "; + cin >> s; + + cnt = 0; + for ( char ch : s ) { + switch ( ch ) { + case 'a': + case 'e': + case 'i': + case 'o': + case 'u': + cnt++; + break; + default: + break; + } + } + + cout << "The string has " << cnt << " vowels.\n"; + + return 0; +} From 15328b884caff892a019056d21a354dceecf8716 Mon Sep 17 00:00:00 2001 From: kelijah1121 <148648133+kelijah1121@users.noreply.github.com> Date: Thu, 26 Oct 2023 17:23:31 -0500 Subject: [PATCH 3/3] Update matrix_linear.cpp fixed small typo in library causing code to not work --- algorithms/matrix_linear.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algorithms/matrix_linear.cpp b/algorithms/matrix_linear.cpp index d466729f..75ead31e 100644 --- a/algorithms/matrix_linear.cpp +++ b/algorithms/matrix_linear.cpp @@ -1,5 +1,5 @@ // represent linear equation in form of matrix -#include +#include #include using namespace std;