summaryrefslogtreecommitdiff
path: root/3p8-v2.cpp
blob: 727ae60dd8387b788e30ac03cfc23b2b963021f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>

/*
 *
 * 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;
}