Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Program to print last N lines in c++
In this tutorial, we will be discussing a program to print the last N lines.
For this, we will be provided with a string that consists of the new line character to denote the start of the next line and the number of lines to be printed from the last. Our task is to start from the last and print all the N lines counting from the last.
Example
#includeusing namespace std; #define DELIM '\n' //printing the last N lines void print_last_lines(char *str, int n){ if (n Output
str12 str13 str14 str15 str16 str17 str18 str19 str20 str21 str22 str23 str24 str25
Advertisements
