Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to inout multiple lines and output then numbers of lines and legnth of lines. I'm trying to figure out how to do that, but

How to inout multiple lines and output then numbers of lines and legnth of lines.

I'm trying to figure out how to do that, but no luck so far. So, I want to be able to enter multiple lines, let say variable n.

Then I want be able to enter numbers as well.

The input and output would be something like this.

Input: ABC Hello World 2020 25 Up 17.5

Output: Numbers of lines = 4 (total lines) Largest line = 16 (characters long) Int numbers counted = 2 (25 and 2020 are int only)

I thought that doing something like this would work, but I don't understand why not.

string lines; int n = 0; int length = 0; int numbers = 0; while (getline(cin, lines)) { cout << "Numbers of lines = " << (not sure what to put) cout << "Largest line = " << lines.length () << endl; cout << "Int numbers counted = " << find(int) << endl; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

Students also viewed these Databases questions