Thread: C++ challenge: Sum of numbers

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396

    C++ challenge: Sum of numbers

    This one is fairly simple but it should help get you thinking about slightly different ways of doing things in C++.

    This challenge is C++ only. If you can solve it in C, I will be extremely impressed, though.

    Challenge: Write a program which reads integer values from standard input until EOF, then displays their sum on standard output. Do not worry about overflow.

    The Goofy Part: Your program must contain EXACTLY ONE SEMICOLON. If you choose to "return 0;" at the end of main(), that semicolon does not count.

    You may, and most likely will, use any and all features of standard C++ including STL.
    Last edited by brewbuck; 10-12-2007 at 11:29 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with programming assignment, please!
    By xMEGANx in forum C++ Programming
    Replies: 2
    Last Post: 02-16-2008, 05:29 PM
  2. Finding the sum of even numbers using arrays
    By Fox101 in forum C Programming
    Replies: 7
    Last Post: 12-03-2007, 02:20 PM
  3. Help With Stacks
    By penance in forum C Programming
    Replies: 7
    Last Post: 10-09-2005, 02:47 PM
  4. adding odd numbers only
    By CheyenneWay in forum C++ Programming
    Replies: 12
    Last Post: 05-06-2004, 12:22 AM
  5. A (complex) question on numbers
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 02-03-2002, 06:38 PM