Skip to content

Instantly share code, notes, and snippets.

@kdmkdmkdm
Created November 17, 2012 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdmkdmkdm/4101567 to your computer and use it in GitHub Desktop.
Save kdmkdmkdm/4101567 to your computer and use it in GitHub Desktop.
textbookcopy
// 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