Setting Precision and a Map question

Hi Everyone,
I have two questions ;)
1. I want to limit the precsion of the values to say 2 decimal points before I store the values in some container (vector). That is, say, if the value is 0.567899, I want to store 0.57. How do I do that ?

2. I have a map such that,
map<pair<int, int>, vector<double> >

such as,
map[pair(10, 11)][0] = .29;
map[pair(10, 11)][1] = .00;
map[pair(10, 12)][0] = .23;
map[pair(10, 12)][1] = .00;
map[pair(10, 13)][0] = .00;
map[pair(10, 14)][1] = .22;
map[pair(10, 14)][0] = .00;
map[pair(10, 15)][1] = .22;
map[pair(20, 11)][0] = .21;
map[pair(20, 11)][1] = .0;
map[pair(20, 12)][0] = .12;
map[pair(20, 12)][1] = .00;
map[pair(20, 13)][0] = .1;
map[pair(20, 14)][1] = .11;
map[pair(20, 14)][0] = .0;
map[pair(20, 15)][1] = .21;



In the vector<double> I always have two values (ie, vector has 2 elements).
such above.

Now, for first key value of 10 in the pair, I want to find the highest value of of the second pair value that makes the value of first vector element zero.

That is, 14 in this example for the following entry.
map[pair(10, 14)][0] = .00;

How do I do this ?

Many thanks.

Mike
1. I just wrote a short function for this purpose: http://www.cplusplus.com/forum/general/4011/
2. I'm not sure I understood you correctly. You mean you want to find the highest value for map[pair(10,0..n-1)][1] that also map[pair(10,0..n-1)][0]==0?
Topic archived. No new replies allowed.