From 832104ca243fbb158af355755fd17a69242bd681 Mon Sep 17 00:00:00 2001 From: revaadi Date: Thu, 3 Oct 2024 00:23:08 -0400 Subject: [PATCH] Added Calm Sort Funny Algorithm using C++ --- sort/Calmly_sort/calm_sort_funny.cpp | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sort/Calmly_sort/calm_sort_funny.cpp diff --git a/sort/Calmly_sort/calm_sort_funny.cpp b/sort/Calmly_sort/calm_sort_funny.cpp new file mode 100644 index 00000000..23e89bb1 --- /dev/null +++ b/sort/Calmly_sort/calm_sort_funny.cpp @@ -0,0 +1,59 @@ +#include +#include +using namespace std; +/* + *Welcome to Calmly Sorting! Here we are sorting values entered by the user + *and sorting them in ascending order. We don't have to rush everything in life, sometimes it's nice + *to take things slow and really visualize the process!! + */ +void calm_sort(vector& arr) { + cout << "Starting Calm Sort... Let's take it slow and step by step and not rush! Time to relax and learn slowly!"<< endl; + cin.get(); //makes user click enter before continuing (keeps things interactive!) + //loops through list given by user + for (size_t i = 0; i < arr.size(); i++) { + cin.get(); + cout << "Understanding value " << arr[i] << "... thinking and contemplating life..."< arr[j]) { + cout <<"There we go, time to SWAP! "<< arr[i]<< " with "<< arr[j]< arr; + int user_values; + //asks user to enter # of values + cout<< "Welcome to Calmly Sort! Please enter the number of values you want to enter and sort: "; + cin >> user_values; + // user enters their specific numbers they would like to sort + cout << "Please enter " <>value; + arr.push_back(value); + } + cout <<"Original List: "; + for (int n :arr) cout << n << " "; + cout << endl; + + //call function to start sorting + calm_sort(arr); + + cout << "Sorted List: " ; + for (int n :arr) cout << n << " "; + cout << endl; + return 0; +}