THRIFT-2691 - C++ tutorial: printfs removed, generated operator<< used
diff --git a/tutorial/cpp/CppClient.cpp b/tutorial/cpp/CppClient.cpp
index 4218019..8ef976b 100644
--- a/tutorial/cpp/CppClient.cpp
+++ b/tutorial/cpp/CppClient.cpp
@@ -17,9 +17,7 @@
  * under the License.
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/time.h>
+#include <iostream>
 
 #include <thrift/protocol/TBinaryProtocol.h>
 #include <thrift/transport/TSocket.h>
@@ -45,10 +43,9 @@
     transport->open();
 
     client.ping();
-    printf("ping()\n");
+    cout << "ping()" << endl;
 
-    int32_t sum = client.add(1,1);
-    printf("1+1=%d\n", sum);
+    cout << "1 + 1 = " << client.add(1, 1) << endl;
 
     Work work;
     work.op = Operation::DIVIDE;
@@ -57,26 +54,27 @@
 
     try {
       client.calculate(1, work);
-      printf("Whoa? We can divide by zero!\n");
-    } catch (InvalidOperation &io) {
-      printf("InvalidOperation: %s\n", io.why.c_str());
+      cout << "Whoa? We can divide by zero!" << endl;
+    } catch (InvalidOperation& io) {
+      cout << "InvalidOperation: " << io.why << endl;
+      // or using generated operator<<: cout << io << endl;
     }
 
     work.op = Operation::SUBTRACT;
     work.num1 = 15;
     work.num2 = 10;
     int32_t diff = client.calculate(1, work);
-    printf("15-10=%d\n", diff);
+    cout << "15 - 10 = " << diff << endl;
 
     // Note that C++ uses return by reference for complex types to avoid
     // costly copy construction
     SharedStruct ss;
     client.getStruct(ss, 1);
-    printf("Check log: %s\n", ss.value.c_str());
+    cout << "Received log: " << ss << endl;
 
     transport->close();
-  } catch (TException &tx) {
-    printf("ERROR: %s\n", tx.what());
+  } catch (TException& tx) {
+    cout << "ERROR: " << tx.what() << endl;
   }
 
 }