Created
October 15, 2012 13:36
-
-
Save HappyCerberus/3892497 to your computer and use it in GitHub Desktop.
Istream iterator demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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