Like for example(adsbygoogle = window.adsbygoogle || []).push({});

Prompting message reads.

"Please enter a positive value"

Example:

Please enter a positive value: 234.7

Rounded to the nearest integer the number is: 235

Please enter a positive value: 10.3

Rounded to the nearest integer the number is: 10

What I have

int num;

cout<< "Please enter a positive value";

cin>> num;

cout<< num << endl;

The problem is that doesn't round the number to the nearest interger so what would I do to round it?

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# (C++) How would I display a value rounded to the nearest integer?

**Physics Forums | Science Articles, Homework Help, Discussion**