summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--3p10.cpp34
-rw-r--r--3p11.cpp29
2 files changed, 63 insertions, 0 deletions
diff --git a/3p10.cpp b/3p10.cpp
new file mode 100644
index 0000000..4863abf
--- /dev/null
+++ b/3p10.cpp
@@ -0,0 +1,34 @@
+#include <iostream>
+#include "sales_data.hpp"
+#include "sales_item.hpp"
+
+/*
+ *
+ * 3.10
+ *
+ * Not sure if i was supposed to support full sentences with whitespace but i decided to do that because it is a bit nicer.
+ */
+
+using std::string;
+using std::cout;
+using std::cin;
+using std::cerr;
+using std::clog;
+using std::endl;
+int main () {
+
+ string Phrase;
+ if(getline(cin, Phrase)) {
+ for(auto &c : Phrase) {
+ if(!ispunct(c)) {
+ cout << c;
+ }
+ }
+ cout << endl;
+ } else {
+ cout << "Error!" << endl;
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/3p11.cpp b/3p11.cpp
new file mode 100644
index 0000000..f2fb9cf
--- /dev/null
+++ b/3p11.cpp
@@ -0,0 +1,29 @@
+#include <iostream>
+#include "sales_data.hpp"
+#include "sales_item.hpp"
+
+/*
+ *
+ * 3.11
+ *
+ * Yes, its legal. We aren't trying to do any write operations to the string.
+ * The type for c is const char&
+ * Also known as a reference to const char
+ */
+
+using std::string;
+using std::cout;
+using std::cin;
+using std::cerr;
+using std::clog;
+using std::endl;
+int main () {
+
+ const string s = "Keep out!";
+ for (auto &c : s) {
+ /* ... */
+ cout << c; // I put this cout here so it compiles with the flags i have enabled.
+ }
+
+ return 0;
+}