diff options
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; +} |