From 97df48a5d420072c1ed487b7d5306d1665e692db Mon Sep 17 00:00:00 2001 From: Oskar Date: Fri, 9 Aug 2024 12:46:41 +0200 Subject: more exercises --- 3p22.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 3p22.cpp (limited to '3p22.cpp') diff --git a/3p22.cpp b/3p22.cpp new file mode 100644 index 0000000..488d85d --- /dev/null +++ b/3p22.cpp @@ -0,0 +1,42 @@ +#include +#include +#include "sales_data.hpp" +#include "sales_item.hpp" + +/* + * + * 3.22 + * + * I'll be honest. I actually have no idea what i was supposed to do in this exercise. + * So i just made it so the program toupper's all the strings until a blank string is encountered + * Everything after the blank string is not processed or printed. + */ + +using std::string; +using std::cout; +using std::cin; +using std::cerr; +using std::clog; +using std::endl; +using std::vector; + +int main () { + + vector text; + string s1; + while(getline(cin, s1)) { + text.push_back(s1); + } + + for(auto vi = text.begin() ; vi != text.end() && !vi->empty() ; vi++) { + for(auto &cc : *vi) { + cc = toupper(cc); + } + } + + for (auto it = text.cbegin() ; it != text.cend() && !it->empty() ; ++it) { + cout << *it << endl; + } + + return 0; +} -- cgit v1.2.3