play around with division

This commit is contained in:
neingeist 2014-08-18 19:50:41 +02:00
parent e14177b097
commit cae45c8613
3 changed files with 20 additions and 0 deletions

1
.gitignore vendored
View file

@ -20,3 +20,4 @@ bad_alloc
rtti
future
return-type-deduction
division

View file

@ -18,6 +18,7 @@ add_executable(classes classes.cpp)
add_executable(lvalues lvalues.cpp)
add_executable(bad_alloc bad_alloc.cpp)
add_executable(rtti rtti.cpp)
add_executable(division division.cpp)
add_executable(future future.cpp)
set_target_properties(future PROPERTIES LINK_FLAGS "-pthread")

18
division.cpp Normal file
View 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;
}