From 06615448f1fd8378817e8ef72b5347ae3f0c3577 Mon Sep 17 00:00:00 2001 From: Oskar Date: Sun, 11 Aug 2024 20:59:53 +0200 Subject: more --- 3p33.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 3p33.cpp (limited to '3p33.cpp') diff --git a/3p33.cpp b/3p33.cpp new file mode 100644 index 0000000..96d0105 --- /dev/null +++ b/3p33.cpp @@ -0,0 +1,43 @@ +#include +#include +#include "sales_data.hpp" +#include "sales_item.hpp" + +/* + * + * 3.33 + * + * + */ + +using std::string; +using std::cout; +using std::cin; +using std::cerr; +using std::clog; +using std::endl; +using std::vector; +int main () { + /* + Because we assume all score clusters to start at a value of 0 when we increment, + we need to initialize them with 0 because if we did not then each array element + could have any value because it is uninitialized. + + When we compile the program and run, we can see the uninitialized values get + printed. + */ + unsigned scores[11]; + unsigned grade; + while (cin >> grade) { + if (grade <= 100) { + ++scores[grade/10]; + } + } + + for (auto i : scores) { + cout << i << " "; + } + + cout << endl; + return 0; +} -- cgit v1.2.3