Horje
c++ load file as vector Code Example
c++ load file as vector
#include <iostream>
#include <iterator>
#include <fstream>
#include <vector>
#include <algorithm> // for std::copy

int main()
{
  std::ifstream is("numbers.txt");
  std::istream_iterator<double> start(is), end;
  std::vector<double> 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<double>(std::cout, " "));
  std::cout << std::endl;

}




Cpp

Related
size of array Code Example size of array Code Example
how to turn int into string c++ Code Example how to turn int into string c++ Code Example
Traversing a map Code Example Traversing a map Code Example
C++ generate a random letter Code Example C++ generate a random letter Code Example
how to check a number in string Code Example how to check a number in string Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11