Short and Sweet Part 2.

This is a discussion on Short and Sweet Part 2. within the C++ Programming forums, part of the General Programming Boards category; you can just write sum = 0.0; and it will be ok...

  1. #16
    "I Win!" by U. Lose vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    you can just write sum = 0.0; and it will be ok
    To be or not to be == true

  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.

Page 2 of 2 FirstFirst 12
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, 09:15 AM
  3. Delete a binary record
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 07-01-2002, 03:07 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21