From 2412f95964221bf7707ad435b91ba5179e8e47a0 Mon Sep 17 00:00:00 2001 From: Krishna Vedala Date: Thu, 28 May 2020 15:55:46 -0400 Subject: [PATCH] document vector sort, reverse example --- others/vector_important_functions.cpp | 60 +++++++++++++-------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/others/vector_important_functions.cpp b/others/vector_important_functions.cpp index e0a70eeda..d23ff9c97 100644 --- a/others/vector_important_functions.cpp +++ b/others/vector_important_functions.cpp @@ -1,45 +1,43 @@ -// A C++ program to demonstrate working of sort(), -// reverse() +/** + * @file + * @brief A C++ program to demonstrate working of std::sort(), std::reverse() + */ #include #include +#include // For accumulate operation #include -#include //For accumulate operation -using namespace std; -int main() -{ - // Initializing vector with array values - int arr[] = {10, 20, 5, 23 ,42 , 15}; - int n = sizeof(arr)/sizeof(arr[0]); - vector vect(arr, arr+n); +/** Main function */ +int main() { + // Initializing vector with array values + int arr[] = {10, 20, 5, 23, 42, 15}; + int n = sizeof(arr) / sizeof(arr[0]); + std::vector vect(arr, arr + n); - cout << "Vector is: "; - for (int i=0; i