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
SimpleList Example
C++ Template
DESim Example
K combinator - Lazy evaluation
Narrowing error
problem_name_4
Alternation regex
How to test call member?
Random values and probability distribution
Dequeue Array-Based Example