# Using log10 and float and static_cast

September 15, 2010 at 11:17:52
Specs: Windows 7
 // Solution Hint: the base10 logarithm of a number // (available in a function named "log10") tells what // exponent to raise 10 to to get that number. // e.g. 10^2 = 100, so log10(100) = 2; log10(1000) = 3, etc. // Numbers between 100 and 1000 would have logarithms // between 2 and 3 (so if you drop the fraction, you get 2). // // BUT: log10 expects a real number of some kind // (float or double) as an argument, so to successfully // use it in Visual Studio, one must convert the value // above to a real number first, and then convert the // computed logarithm back to an integer for the desired result. // You may use either static_cast() or (float) // to convert an integer to float; and similarly in the reverse. // // NOTE: A correct solution that handles all valid integers // will still need an IF statement!

See More: Using log10 and float and static_cast

#1
September 15, 2010 at 13:49:17
 Homework so soon.

Report •

#2
September 16, 2010 at 10:16:54

Report •

#3
September 16, 2010 at 11:05:02
 Yeah. Good thing my grade doesn't depend on it, huh?

Report •

Related Solutions

#4
September 17, 2010 at 09:33:53
 Figured it out myself, was just looking for help. What a nice forum damn.

Report •

#5
September 17, 2010 at 09:37:56
 You weren't looking for help; you were looking for someone to do it for you (and went about it in a very rude manner). There's a difference. Learn it.

Report •

#6
September 17, 2010 at 09:41:30
 I didn't need a reply of homework so soon or else I wouldn't have been rude. There was no need for that reply.

Report •

#7
September 17, 2010 at 09:50:57
 I'm not buying it. You copy paste your homework, don't bother to remove the C++ comment marks, act like we're obligated to do it, then get upset when we call you out on it.

Report •

#8
September 17, 2010 at 19:10:24
 I said so soon because September is usually the start of the academic year. Out in the real world you would have to define the problem, design the solution, then test the boundaries of the solution.

Report •

#9
September 18, 2010 at 07:50:35
 My bad then but honestly was just looking for help sorry for coming across ignorant.

Report •