A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/db/de3/numeric__string__sort_8cpp_source.html below:

TheAlgorithms/C++: sorting/numeric_string_sort.cpp Source File

16bool

NumericSort(std::string a, std::string b) {

17 while

(a[0] ==

'0'

) {

20 while

(b[0] ==

'0'

) {

32

std::cout <<

"Enter number of elements to be sorted Numerically\n"

;

35

std::vector<std::string> v(n);

36

std::cout <<

"Enter the string of Numbers\n"

;

37 for

(

int

i = 0; i < n; i++) {

41

sort(v.begin(), v.end());

42

std::cout <<

"Elements sorted normally \n"

;

43 for

(

int

i = 0; i < n; i++) {

44

std::cout << v[i] <<

" "

;

48

std::sort(v.begin(), v.end(), NumericSort);

49

std::cout <<

"Elements sorted Numerically \n"

;

50 for

(

int

i = 0; i < n; i++) {

51

std::cout << v[i] <<

" "

;

int main()

Main function.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4