summaryrefslogtreecommitdiff
path: root/4p23.cpp
diff options
context:
space:
mode:
Diffstat (limited to '4p23.cpp')
-rw-r--r--4p23.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/4p23.cpp b/4p23.cpp
new file mode 100644
index 0000000..b53cc84
--- /dev/null
+++ b/4p23.cpp
@@ -0,0 +1,26 @@
+#include <iostream>
+
+/*
+ *
+ * 4.23
+ *
+ *
+ */
+
+int main () {
+
+ /*
+
+ Took me a while to figure out
+ was not so sure what the author
+ wanted to achieve. I mean there
+ are several ways we can paranthesize
+ this so it was a little hard to do...
+
+ */
+
+ std::string s = "word";
+ std::string pl = s + (s[s.size() - 1] == 's' ? "" : "s") ;
+ std::cout << pl << std::endl;
+ return 0;
+}