Created
November 17, 2012 23:47
-
-
Save kdmkdmkdm/4101567 to your computer and use it in GitHub Desktop.
textbookcopy
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
// sumunknown.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <iostream> | |
int main() | |
{ | |
int sum = 0, value = 0; | |
// read until end-of-file, calculating a running total of all values read | |
while (std::cin >> value) | |
sum += value; | |
std::cout << "Sum is: " << sum << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment