play around with division
This commit is contained in:
parent
e14177b097
commit
cae45c8613
3 changed files with 20 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -20,3 +20,4 @@ bad_alloc
|
||||||
rtti
|
rtti
|
||||||
future
|
future
|
||||||
return-type-deduction
|
return-type-deduction
|
||||||
|
division
|
||||||
|
|
|
@ -18,6 +18,7 @@ add_executable(classes classes.cpp)
|
||||||
add_executable(lvalues lvalues.cpp)
|
add_executable(lvalues lvalues.cpp)
|
||||||
add_executable(bad_alloc bad_alloc.cpp)
|
add_executable(bad_alloc bad_alloc.cpp)
|
||||||
add_executable(rtti rtti.cpp)
|
add_executable(rtti rtti.cpp)
|
||||||
|
add_executable(division division.cpp)
|
||||||
|
|
||||||
add_executable(future future.cpp)
|
add_executable(future future.cpp)
|
||||||
set_target_properties(future PROPERTIES LINK_FLAGS "-pthread")
|
set_target_properties(future PROPERTIES LINK_FLAGS "-pthread")
|
||||||
|
|
18
division.cpp
Normal file
18
division.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#include <cassert>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
assert(0/2 == 0);
|
||||||
|
assert(1/2 == 0);
|
||||||
|
assert(2/2 == 1);
|
||||||
|
assert(3/2 == 1);
|
||||||
|
assert(4/2 == 2);
|
||||||
|
assert(5/2 == 2);
|
||||||
|
|
||||||
|
assert(0.0/2 == 0);
|
||||||
|
assert(1.0/2 == 0.5);
|
||||||
|
assert(2.0/2 == 1);
|
||||||
|
assert(2.0/2 == 1.0);
|
||||||
|
|
||||||
|
std::cout << "divided we stand." << std::endl;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue