Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started