From 73fa2deee10e9c80b4598683fd5abe54cbc6d880 Mon Sep 17 00:00:00 2001 From: pudepiedj Date: Thu, 5 Oct 2023 12:18:21 +0100 Subject: [PATCH] Update cmap-example --- examples/cmap-example/cmap-example.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/examples/cmap-example/cmap-example.cpp b/examples/cmap-example/cmap-example.cpp index e3af5073f..c6db1129b 100644 --- a/examples/cmap-example/cmap-example.cpp +++ b/examples/cmap-example/cmap-example.cpp @@ -1,9 +1,6 @@ // example of a C/C++ equivalent data structure to the python dict -// there are two: std::map automatically sorts on key; std::unordered_map doesn't +// there are two: std::map automatically sorts on key; std::unordered_map does not -#include "llama.h" - -#include #include int main() { @@ -15,10 +12,10 @@ int main() { // Accessing elements in the map - std::cout << "Value of apple: " << dict["apple"] << std::endl; + printf("Value of apple: %d\n", dict["apple"]); for (const auto& pair : dict) { - std::cout << "Key: " << pair.first << ", Value: " << pair.second << std::endl; + printf("Key: %s, Value: $s\n", pair.first, pair.second); } return 0;