Thread: Short and Sweet Part 2.

  1. #16
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    you can just write sum = 0.0; and it will be ok
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

  2. #17
    Registered User
    Join Date
    Feb 2008
    Quote Originally Posted by Daved View Post
    That just initializes the sum to zero. Since sum is a float, vart used a float value to initialize it. Numbers with decimals are doubles in C++, but since you are using floats, you have to add the f to the end to indicate that you want to use float. (doubles are actually recommended over float assuming you don't have a requirement to use float.)
    We were required to use float. You guys are the greatest. I changed just a few things to get it to look like what I have actually learned but nonetheless, thank you so much. Now I get to move on to step 4 which should be interesting. Choosing every third integer to sum.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Short & Sweet for a beginner
    By dispatch4599 in forum C++ Programming
    Replies: 5
    Last Post: 03-02-2008, 08:33 PM
  2. Function Overloading Short & Sweet Query
    By forumuser in forum C++ Programming
    Replies: 15
    Last Post: 10-17-2007, 08:15 AM
  3. Delete a binary record
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 07-01-2002, 02:07 AM