I'm in the process of trying to learn the C++ language, and I'm
looking for small projects that could help me practice. I need a
project that will let apply the concepts I'm learning, or I'll have
forgotten them in a week. Any help is greatly appreciated.
Implement the top-20 utility discussed here last week.
top20 some_text_file
outputs the 20 lines of 'some_text_file' which sort first,
like Unix sort some_text_file | head -20 would.
top20 file1 file2 file3
is the same thing, except the three files are seen as
one big file
top20
is the same thing, except you read from std::cin.
top20 -N42 file
produces a top-42 list instead
top20 -r file
reverses the sorting, like sort -r
top20 -n file
does a numerical sort, like sort -n
top20 -N5 -n -r file
the options combine, of course
Write it so the program doesn't use more memory the larger the input
file is.
Also construct test cases. Not unit tests but full-system tests.
/Jorgen