diff options
author | Oskar <[email protected]> | 2024-08-12 17:13:23 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-08-12 17:13:23 +0200 |
commit | 0863591e1aa4a172e376dcdc9c3e0d2c39a63019 (patch) | |
tree | 38289669b386ba7a31610ad46cbf921652336195 /3p35.cpp | |
parent | 4555acdaeae73b8c2d49696c9766366ead8eb847 (diff) |
more
Diffstat (limited to '3p35.cpp')
-rw-r--r-- | 3p35.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/3p35.cpp b/3p35.cpp new file mode 100644 index 0000000..b24d099 --- /dev/null +++ b/3p35.cpp @@ -0,0 +1,43 @@ +#include <iostream> +#include <vector> +#include <iterator> +#include "sales_data.hpp" +#include "sales_item.hpp" + +/* + * + * 3.35 + * + * + */ + +int main () { + + int ia[50]; // We make it uninitialized and print it so we can easily see before and after + for(auto r : ia) { + std::cout << r << " "; + } + + std::cout << std::endl; + /* + // Different loops we can use, commented out here is using a while loop + // And uncommented further below is using a for loop + + auto p_begin = std::begin(ia); + auto p_end = std::end(ia); + while(p_begin != p_end) { + *p_begin = 0; + ++p_begin; + } + */ + for(auto p_beg = std::begin(ia) ; p_beg != std::end(ia) ; ++p_beg) { + *p_beg = 0; + } + + for(auto r : ia) { + std::cout << r << " "; + } + + std::cout << std::endl; + return 0; +} |