Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Rounding float to nearest 1000 (fixed)
//clang 3.8.0 #include <iostream> #include <cmath> using namespace std; int main() { float price; cin >> price; int roundedPrice = int(price); int multiple = 1000; roundedPrice = ((roundedPrice + multiple/2) / multiple) * multiple; cout << "Old price was: " << price << '\n'; cout << "New price is: " << roundedPrice; }
run
|
edit
|
history
|
help
0
ECE2574_Function_Calling_Example
Uno
Reverse polish notation
Math1
Heap: insert and deleteMin() Implementations
Linear search
HTML Timetable generator.cpp
regimeketopdfb
Template Meta Programming
hello,world !ssn2019