Pure Programmer
Blue Matrix

Cluster Map

Project: Head and Tail

Write a filter program that prints the first and last few lines from an input stream. The single command line parameter will specify the number of lines from the head and tail to print. The program should print a line "..." between the first lines and the last lines.

$ g++ -std=c++17 HeadAndTail.cpp -o HeadAndTail -lfmt $ ./HeadAndTail < ../../data/text/USConstitution.txt Constitution of the United States of America Preamble We the People of the United States, in order to form a more perfect union, establish justice, insure domestic tranquility, provide for the common defense, promote the general welfare, and secure the blessing of liberty to ourselves and our posterity, do ordain and establish the Constitution of the United States of America. ... Acting President; otherwise, the President shall resume the powers and duties of his office. 26th Amendment Sect. 1. The right of citizens of the United States, who are eighteen years of age or older, to vote shall not be denied or abridged by the United States or by any State on account of age. Sect. 2. The Congress shall have the power to enforce this article by appropriate legislation. $ g++ -std=c++17 HeadAndTail.cpp -o HeadAndTail -lfmt $ ./HeadAndTail < ../../data/text/UnicodeTest.utf8 Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal. Vor vier Punkten und sieben Jahren haben unsere Väter auf diesem Kontinent eine neue Nation hervorgebracht, die in Freiheit empfangen wurde und sich dem Vorschlag verschrieben hat, dass alle Menschen gleich geschaffen sind. Τέσσερα σκορ και πριν από επτά χρόνια οι πατέρες μας έφεραν σε αυτή την ήπειρο, ένα νέο έθνος, που σχεδιάστηκε στην Ελευθερία και αφιερώθηκε στην πρόταση ότι όλοι οι άνθρωποι δημιουργούνται ίσοι. أربع نقاط وقبل سبع سنوات قدم آباؤنا في هذه القارة ، أمة جديدة ، تم تصورها في الحرية ، ومكرسة لفرضية أن جميع الرجال خلقوا متساوين. ארבע ציונים ולפני שבע שנים אבותינו הציגו ביבשת זו, אומה חדשה, שהגתה בחירות, והוקדשה לטענה שכל הגברים נוצרים שווים. ... Graphemes that take two codepoints Canada 🇨🇦 China 🇨🇳 France 🇫🇷 Greece 🇬🇷 Israel 🇮🇱 Japan 🇯🇵 Mexico 🇲🇽 UK 🇬🇧 US 🇺🇸