📅  最后修改于: 2022-03-11 14:44:45.816000             🧑  作者: Mango
#include
#include
#include
#include
#include // for std::copy
int main()
{
std::ifstream is("numbers.txt");
std::istream_iterator start(is), end;
std::vector numbers(start, end);
std::cout << "Read " << numbers.size() << " numbers" << std::endl;
// print the numbers to stdout
std::cout << "numbers read in:\n";
std::copy(numbers.begin(), numbers.end(),
std::ostream_iterator(std::cout, " "));
std::cout << std::endl;
}