about summary refs log tree commit diff
path: root/cpptour/square.cc
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-07-21 03:21:00 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-07-21 03:21:00 +0700
commit029688e143109344989b1529259e391822abb0aa (patch)
tree556f96273a5caed7df2e70a6ba253bcc7627bd33 /cpptour/square.cc
parentbe6678fbca007e73d69c9a9c5cddb8241a987149 (diff)
downloadcp-029688e143109344989b1529259e391822abb0aa.tar.gz
[cpptour] Learn the basis
Diffstat (limited to 'cpptour/square.cc')
-rw-r--r--cpptour/square.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/cpptour/square.cc b/cpptour/square.cc
new file mode 100644
index 0000000..fb14456
--- /dev/null
+++ b/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);
+}