Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// 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