Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


This program numbers the lines found in a text file. Write a
program that reads text from a file and outputs each line
preceded by a line number. Print the line number
right-adjusted in a field of 3 spaces. Follow the line
number with a colon, then one space, then the text of the
line. You should get a character at a time and write code to
ignore leading blanks on each line. You may assume that the
lines are short enough to fit within a line on the screen.
Otherwise, allow default printer or screen output behavior
if the line is too long (i.e., wrap or truncate). A somewhat
harder version determines the number of spaces needed in the
field for the line numbers by counting lines before
processing the lines of the file. This version of the
program should insert a new line after the last complete
word that will fit within a 72-character line.


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer



More OOPS Interview Questions

What is abstraction in oop with example?

0 Answers  


What are the 3 pillars of oop?

0 Answers  


Write a program to accept a number and to print numbers in pyramid format? for eg:for a no. 5 1 212 32123 4321234 543212345

7 Answers  


What is coupling in oops?

0 Answers  


What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }

0 Answers   SRA,






Why is there no multiple inheritance?

0 Answers  


What Is a Polymorphism? How many types of polymorphism and whats that use in application?

2 Answers  


The company is a fake company asking for money of RS10000 while training and not offering a job after training. My humble request to you people not to attend Astersys interview

1 Answers   Astersys,


Base class has two public data members. How can i derive a new class with one datamember as public and another data member as private?.

2 Answers  


Is data hiding and abstraction same?

0 Answers  


What is overriding in oop?

0 Answers  


What is a scope resolution operator?

5 Answers   HP, IBS,


Categories