diff options
author | Oskar <[email protected]> | 2024-08-07 22:39:51 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-08-07 22:39:51 +0200 |
commit | 9b931cfed1551961c8bbb93b21051104c0c4c716 (patch) | |
tree | 9232cc1246d35db36b0800e3d4af318f4e3905c9 /vector-index-example.cpp | |
parent | 601e9571981ef44984e740ba71ce1648dbc223d3 (diff) |
more exercises
Diffstat (limited to 'vector-index-example.cpp')
-rw-r--r-- | vector-index-example.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/vector-index-example.cpp b/vector-index-example.cpp new file mode 100644 index 0000000..f6a0e43 --- /dev/null +++ b/vector-index-example.cpp @@ -0,0 +1,32 @@ +#include <iostream> +#include <vector> +#include "sales_data.hpp" +#include "sales_item.hpp" + +/* + * + * Description + * + * + */ + +using std::string; +using std::cout; +using std::cin; +using std::cerr; +using std::clog; +using std::endl; +using std::vector; +int main () { + + vector<unsigned> scores(11, 0); // 11 buckets, all initially 0 + unsigned grade; + while (cin >> grade) { + if (grade <= 100) { + ++scores[grade/10]; + // scores[grade/10] += 1; // basically equivalent + } + } + + return 0; +} |