View Single Post
  #2   Spotlight this post!  
Unread 19-02-2014, 21:16
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Function-in-a-line!!! (C/C++)

There is a <cmath> function for computing the length of the hypotenuse.

http://www.cplusplus.com/reference/cmath/hypot/

For doing numeric type to string conversions, C++11 supports std::to_string, but without C++11 you could still do your stringstream method with a templated function (since the function body is exactly the same regardless of the argument type).

Last edited by Jared Russell : 19-02-2014 at 21:18.