Skip to content

Instantly share code, notes, and snippets.

@spundun
Created May 30, 2014 18:01
Show Gist options
  • Save spundun/c91c07d7b8233e675d2e to your computer and use it in GitHub Desktop.
Save spundun/c91c07d7b8233e675d2e to your computer and use it in GitHub Desktop.
iostream vs fstream
(1..1000000).each do
puts "12345"
end
#include <ctime>
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<int> data;
int input;
while (cin >> input)
{
data.push_back(input);
}
cout << "Data loaded." << endl;
}
#include <ctime>
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main(int argc, char *argv[]){
vector<int> data;
int input;
ifstream in;
cout << argv[1];
in.open(argv[1]);
while (in >> input)
{
data.push_back(input);
}
cout << "Data loaded." << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment