Skip to content

Instantly share code, notes, and snippets.

@HappyCerberus
Created October 15, 2012 13:36
Show Gist options
  • Save HappyCerberus/3892497 to your computer and use it in GitHub Desktop.
Save HappyCerberus/3892497 to your computer and use it in GitHub Desktop.
Istream iterator demo
#include <iostream>
#include <iterator>
using namespace std;
int main()
{
istream_iterator<int> in(cin);
istream_iterator<int> eof;
long suma = 0;
while (in != eof)
{
suma += *in;
in++;
}
cout << "Suma je : " << suma << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment