From c6a3ec820eeb105752b833c9f5e44f0244a41c6d Mon Sep 17 00:00:00 2001 From: Oskar Date: Sat, 10 Aug 2024 23:48:10 +0200 Subject: more --- 3p25.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 3p25.cpp (limited to '3p25.cpp') diff --git a/3p25.cpp b/3p25.cpp new file mode 100644 index 0000000..44f33de --- /dev/null +++ b/3p25.cpp @@ -0,0 +1,42 @@ +#include +#include +#include "sales_data.hpp" +#include "sales_item.hpp" + +/* + * + * 3.25 + * + * Just a note to myself, i first finished this + * exercise by making a begin variable and also a temporary + * variable and incrementing on the temporary one, but + * of course you can just do everything directly which + * created this ugly thing ++*(scores.begin() + grade / 10); + * A bit difficult to read, and i do wonder if its faster + * + */ + +using std::string; +using std::cout; +using std::cin; +using std::cerr; +using std::clog; +using std::endl; +using std::vector; +int main () { + + vector scores(11, 0); + unsigned grade; + while (cin >> grade) { + if (grade <= 100) { + ++*(scores.begin() + grade / 10); + } + } + + for(auto i : scores) { + cout << i << " "; + } + + cout << endl; + return 0; +} -- cgit v1.2.3