diff options
author | Oskar <[email protected]> | 2024-08-05 20:57:13 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-08-05 20:57:13 +0200 |
commit | 4483699cc8cc937cb27040cfbd809b8a90029391 (patch) | |
tree | 6edbe3e65d3c922c535078161b35d0892e6d34ec /3p8-v2.cpp | |
parent | 1d105b91b9678ffaa8eddea2218ed1789f5be27c (diff) |
more exercises
Diffstat (limited to '3p8-v2.cpp')
-rw-r--r-- | 3p8-v2.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/3p8-v2.cpp b/3p8-v2.cpp new file mode 100644 index 0000000..158de77 --- /dev/null +++ b/3p8-v2.cpp @@ -0,0 +1,33 @@ +#include <iostream> +#include "sales_data.hpp" +#include "sales_item.hpp" + +/* + * + * 3.8 v2 + * + * I think both while and for are viable but i will say the range for is very minimal and nice. + * My C programmer brain feels more at home using something like a regular for / while loop with subscripts + * But i do think the range for is nice. It might take a bit of time getting used to using ranged for loops + * and it might take some time being able to recognise which situations it's best used but i think its a + * great tool to have either way. + */ + +using std::string; +using std::cout; +using std::cin; +using std::cerr; +using std::clog; +using std::endl; +int main () { + + string Xer; + cout << "Enter a string" << endl; + cin >> Xer; + for(decltype(Xer.size()) Index = 0 ; Index != Xer.size() ; ++Index /*or Index++*/) { // Make reference for every character in Xer + Xer[Index] = 'X'; + } + + cout << Xer << endl; + return 0; +} |