2
0

operator__greater.cpp 817 B

123456789101112131415161718192021222324
  1. #include <iostream>
  2. #include <nlohmann/json.hpp>
  3. using json = nlohmann::json;
  4. int main()
  5. {
  6. // create several JSON values
  7. json array_1 = {1, 2, 3};
  8. json array_2 = {1, 2, 4};
  9. json object_1 = {{"A", "a"}, {"B", "b"}};
  10. json object_2 = {{"B", "b"}, {"A", "a"}};
  11. json number_1 = 17;
  12. json number_2 = 17.0000000000001L;
  13. json string_1 = "foo";
  14. json string_2 = "bar";
  15. // output values and comparisons
  16. std::cout << std::boolalpha;
  17. std::cout << array_1 << " > " << array_2 << " " << (array_1 > array_2) << '\n';
  18. std::cout << object_1 << " > " << object_2 << " " << (object_1 > object_2) << '\n';
  19. std::cout << number_1 << " > " << number_2 << " " << (number_1 > number_2) << '\n';
  20. std::cout << string_1 << " > " << string_2 << " " << (string_1 > string_2) << '\n';
  21. }