public
Created

textbookcopy

  • Download Gist
textbookcopy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// 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;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.