Answer to Question #220486 in C++ for shams

Question #220486

Generate the driver file (main.cpp) where you perform the following tasks. Note that you cannot make any change to

the header file or the source file.

Operation to Be Tested and Description of Action Input Values Expected Output

Create a list of integers Print length of the list


1
Expert's answer
2021-07-25T08:39:59-0400
#include <iostream>
#include <list>

int main()
{
  std::list<int> lst;
  
  int input;
  while (std::cin >> input) {
    lst.push_back(input);
  }

  std::cout << "Length of the list:" << lst.size() << std::endl;  

  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS