nearest integer rounding in c++

C++
 cout << "Nearest value of x :" << round(x) << "\n"; 
Source

Also in C++: