Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Rounding float to nearest 1000
//clang 3.8.0 #include <iostream> #include <cmath> using namespace std; int main() { float price; cin >> price; int roundedPrice = int(price); int remainder = roundedPrice % 1000; if (remainder != 0) { roundedPrice = roundedPrice + 1000 - remainder; } cout << "Rounded price is: " << roundedPrice; }
run
|
edit
|
history
|
help
0
regimeketopdfb
Balanced Insert Heap Example
Math1
virtual members
NaN inside set
back_inserter example
Dynamic call
Check if a year is leap year or not
nontype template parameter produced with decltype for function
Pure virtual function called!