Write a program that keeps a count of the lines in the input

Assignment Help Computer Engineering
Reference no: EM132210416

Question :

Write a program that keeps a count of the lines in the input and prints out the line number, the number of characters in the line followed by the line itself.

Input -- The input will be one or more lines of characters that have been typed in by the user.

Output --The output will have for each line, the line number followed by a space, followed by the number of characters in the line, followed by a space, followed by the line that was entered

Sample Input

hello there!

I am a bee

Sample Output

1 12 hello there!

2 10 I am a bee

--HINT Have a variable (say named count) that you keep incrementing by 1 every time you read a new line. Initial value should be 1. Also, use the String's length method to get the length of the line.

Reference no: EM132210416

Questions Cloud

Analyze the flow of patients through the emergency room : Write a program that helps a hospital analyze the flow of patients through the emergency room.
Write a program to convert all letters to lowercase : Write a program to input a string from the user, convert all letters to lowercase, and display the new string.
When is a shark just a shark : When is a shark just a shark? Consider the movie Jaws. What could the shark symbolize in our culture, society, or collective human mythology other.
Write a program which will solve diagonally dominant system : Write a program which will solve a diagonally dominant system of linear equations using Naïve Gaussian Elimination.
Write a program that keeps a count of the lines in the input : Write a program that keeps a count of the lines in the input and prints out the line number, the number of characters in the line followed by the line itself.
A program that let the user input multiple positive integers : Write a program that let the user input multiple positive integers and output the largest integer the user input.
Write a loop that iterates as long as the array has a space : The program should accept up to 6 appointments, making sure that there is no time conflict or an invalid time slot is requested.
Why has the price of bitcoin increased : Why has the price of bitcoin increased over 500% in such a short amount of time? What factors may be behind its sharp rise in price?
Write a program to open a text file for output : Write a program to open a text file for output, then accep tlines of text from the console and write the lines of text to the file.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Find an optimal parenthesization of a matrix-chain product

Find an optimal parenthesization of a matrix-chain product whose sequence of dimensions - show the dynamic programming tables at the end of the computation.

  What would you say to help this customer

The fastest AMD we have runs at clock speed of 1.6 GHz. If you really want the fastest machine, you should buy out 2.2 GHz Intel instead."

  What is the diameter of each screen point

Suppose we have a video monitor with a display area that measures 12 inches across and 9.6 inches high. What is the diameter of each screen point?

  Explain the behavior of an input element with the email type

Explain the behavior of an input element with the email type. What is the purpose of the placeholder attribute of an input element?

  Discuss about the snmp tools

In order to ensure quality of service, what are the measured metrics employed in trunk test system and traffic measurement system.

  How is the height of a red-black tree related to its size

How is the height of a red-black tree related to its size? What is the relationship between red-black trees and B-trees?

  Create a web page that lists at least five hints or facts

Create a Web page that lists at least five hints or facts about the promotion method along with helpful links that provide additional information on the hint.

  What is the maximum frequency error that would be permitted

If the maximum phase rotation permitted is 10°, what is the maximum frequency error that would be permitted as a fraction of the symbol rate?

  What are the latest advancements in cabling

Why would a company want a network on its premises? How will a department or company benefit by having a network.

  Make binary search tree that will accept integers in order

modify a C++ Binary Search Tree that will accept integers in this order: 35, 18, 48, 72, 60, 25. Ask user for input and search tree utilizing integer input. Return "True" if input integer is found or "False" if it is not found in tree.

  Calculate the sentiment of each tweet

- Calculate the sentiment of each tweet - Calculate the sentiment of each group - Visualize the hierarchical structure of the data, the rank of groups

  Write a method to recursively computer ackermann function

Write a method to recursively computer the Ackermann function. Note that the Ackermann function grows extremely quickly for even small values of m and n.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd