Πρόγραμμα: blinky.c
Γράψτε ένα πρόγραμμα το οποίο διαβάζει κείμενο από την πρότυπη είσοδο (stdin) και το τυπώνει στην πρότυπη έξοδο (stdout) με τους εξής περιορισμούς:
Παράδειγμα εκτέλεσης ακολουθεί:
Αν για κάποιο λόγο δεν παίζει το παραπάνω link:
$ gcc -o blinky blinky.c
$ cat description.txt
In the Pac-Man universe, Blinky is the red ghost who
persistently chases the game's hero, earning the
nickname "Shadow" for his relentless pursuit.
Blinky's strategy intensifies as Pac-Man consumes
more dots, making Blinky a formidable challenge and
a central figure in game strategy. His vivid red hue
not only marks Blinky as the primary antagonist but
also signals the immediate threat he poses.
$ ./blinky < description.txt
In the Pac-Man universe, *Blinky* is the red ghost who
persistently chases the game's hero, earning the
nickname "Shadow" for his relentless pursuit.
*Blinky*'s strategy intensifies as Pac-Man consumes
more dots, making *Blinky* a formidable challenge and
a central figure in game strategy. His vivid red hue
not only marks *Blinky* as the primary antagonist but
also signals the immediate threat he poses.
Μαζέψτε κάθε λέξη (μέγιστη ακολουθία λατινικών χαρακτήρων) σε έναν buffer και, όταν τελειώσει, συγκρίνετέ τη ολόκληρη με το Blinky· έτσι το Blinky μέσα σε μεγαλύτερη λέξη δεν αλλάζει. Οι διαχωριστικοί χαρακτήρες τυπώνονται αυτούσιοι. Το «έντονο» (και αντίστοιχα το πλάγιο ή το αναβόσβημα) στο τερματικό γίνεται με ακολουθίες διαφυγής ANSI (ANSI escape codes) που τυπώνετε πριν και μετά το κείμενο, π.χ. \033[...m· ψάξτε ποιος κωδικός αντιστοιχεί στο εφέ που θέλετε και ποιος τα επαναφέρει.
Αριθμός στον οδηγό: Α9.27
(στο κεφάλαιο) ·
Μόνιμο αναγνωριστικό: exam-2023-fall-ex11-q1 ·
Σύνδεσμος: https://progintro.github.io/study/questions/exams/exam-2023-fall-ex11-q1.html ·
Markdown (GitHub)