diff options
Diffstat (limited to '3p7.cpp')
-rw-r--r-- | 3p7.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -0,0 +1,30 @@ +#include <iostream> +#include "sales_data.hpp" +#include "sales_item.hpp" + +/* + * + * 3.7 + * + * Nothing different happens, pretty much same result. Though auto might just be better so we are sure what type it is. + * Unless the author meant that we were supposed to do char rather than (char&). If we were to just do 'char' type then + * we wouln't be able to modify the characters in the string, therefore the string remains unchanged. + */ + +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(char &c : Xer) { // Make reference for every character in Xer + c = 'X'; + } + cout << Xer << endl; + return 0; +} |