Greetings,
I am trying to find some examples of a range of values stored in a vector<double>, i mean the difference between the largest value and smallest value. Can anyone show me some simple examples that i can learn from?
This is a discussion on vector<double> ranges within the C++ Programming forums, part of the General Programming Boards category; Greetings, I am trying to find some examples of a range of values stored in a vector<double>, i mean the ...
Greetings,
I am trying to find some examples of a range of values stored in a vector<double>, i mean the difference between the largest value and smallest value. Can anyone show me some simple examples that i can learn from?
"Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
-Bruce Lee
Then you want the properties for a double. The fact that they are stored in a vector is of no consequence.
So you want to get the numeric_limits, a la...
Code:cout << numeric_limits<double>::max() << '\n'; cout << numeric_limits<double>::min() << '\n';
What...you mean the biggest & smallest values in a double??
<edit> Doh..beaten </edit>Code:#include <iostream> #include <limits> int main(){ typedef std::numeric_limits<double> lim; std::cout << lim::max() << std::endl; std::cout << lim::min() << std::endl; }
thanks for your input!
"Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
-Bruce Lee