about summary refs log tree commit diff
path: root/lang/cpptour/square.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lang/cpptour/square.cc')
-rw-r--r--lang/cpptour/square.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/lang/cpptour/square.cc b/lang/cpptour/square.cc
new file mode 100644
index 0000000..fb14456
--- /dev/null
+++ b/lang/cpptour/square.cc
@@ -0,0 +1,21 @@
+#include <iostream>
+
+using namespace std;
+
+double
+square (double x)
+{
+  return x * x;
+}
+
+void
+print_square (double x)
+{
+  cout << "the quare of " << x << " is " << square (x) << endl;
+}
+
+int
+main ()
+{
+  print_square (1.234);
+}