Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Trainee-cpp-sort is an imitation of the satandard sort command. I recommend to use this only for test and learning purposes. I developed this sort program so that I can gradually learn to use C ++.

License

NotificationsYou must be signed in to change notification settings

yhabteab/trainee-cpp-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

trainee-cpp-sort is a program that has been developed from the beginning and should be an imitation of the standard sortcommand. It was only developed for learning and testing purposes, so I cannot guarantee that it will work perfectly witha real complicated program.

quick sort and merge sort algorithm have also been added to the program, so that with various sort options you have ampleopportunities to simplify your work.

To learn more about what they mean and what they are for, see the bunch of sort options below.

Parameters

short Optionslong OptionsUsage
-b--ignore-leading-blanksIgnore leading blanks.
-f--ignore-caseIgnore case e.g (uppercase or lowercase) this would be ignored.
-n--numeric-sortNumeric sort from the lowest the highest.
-o--output[ARG required]Write result in FILE instead of standard output.
-r--reverseReverse the result of sorting.
-R--random-sortSort the keys using a random hash.
-u--uniqueOnly output the first of several matches.
-q--quick-sortUse quick sort Algorithm.
-m--merge-sortUse merge sort Algorithm.
-h--helpDisplay this help and exit the Program.

Examples of sort commands..

First of all we have to compile our code and this is done by doing the command as follows./build.sh. This will compile and build your code.If./build.sh doesn't work for you, you can trychmod +x build.sh and it should work now.And the compiled code is saved in thecpp-sort file asmachine code.

Now we can e.g. execute this command to sort the contents of thein.txt filenumeric-sort.content ofin.txt file:

496151031287

The output looks like this, if you run this command./cpp-sort -n in.txt OR./cpp-sort -n < in.txt.

346789101215

if you would like to sort with quick sort or merge sort you only have to change a little bit when executingthe commands as follows./cpp-sort -q -n in.txt OR./cpp-sort --quick-sort -n < in.txt

And we do the same with merge sort./cpp-sort -m -n in.txt OR./cpp-sort --merge-sort -n < in.txt.They all work like clockwork.

And if you want to store the sorted values ​​in a new file, you only have to do as follows..

./cpp-sort -n -o output.txt in.txt OR./cpp-sort -n --output output.txt < in.txtthen check theoutput.txt file.

CONTRIBUTING

I hope you have as much fun with it as I have when coding and would be very happy if you would develop the programfurther or if you could give me suggestions how I can do it even better.

Your are always welcome to contribute in this repository

Thank you 👍

About

Trainee-cpp-sort is an imitation of the satandard sort command. I recommend to use this only for test and learning purposes. I developed this sort program so that I can gradually learn to use C ++.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp