Reputation: 347
If I input "we are going to have fun in school" when executing the following code, it seems to break after the first word and only prints "W3". Does anyone know what I did wrong?
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
string s;
cout << "Invoer: ";
cin >> s;
replace( s.begin(), s.end(), 'e', '3' );
replace( s.begin(), s.end(), 'o', '0' );
replace( s.begin(), s.end(), 't', '7' );
replace( s.begin(), s.end(), 'l', '1' );
transform( s.begin(), s.end(), s.begin(), ::toupper);
cout << s << endl;
return 0;
}
Upvotes: 1
Views: 608