How do you round numbers?

I've been writing a program that looks through a set of data and chooses the value that is the highest and all the data is of type double. If for example i have the set of data 31.2, 11.6, and 3.1 my program would choose 31.2, but i need to run a for loop the number of times as the max value in the set of data, and you cant do a for loop 31.2 times. So is there a way to take that number and round it up to the nerest factor of 1? so instead of 31.2 it would be 32?
Do you mean something like this..??

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
using namespace std;

int main ()
{
	double num = 32.5;
	int convert = 0;

	cout << num << "  " << convert<<endl;

	convert = num;

	cout << num << "  " << convert<<endl;
	
	cin.ignore().get();
	return 0;
}
That truncates. 32.5 --> (int)32, not 33.

I wrote an article on this some time ago:
http://www.cplusplus.com/forum/articles/3638/

Hope this helps.
Topic archived. No new replies allowed.