Nabeel Alzahrani <nalza...@ucr.edu> added the comment:
But when I turn off the "autojunk" feature for the following example, I get the wrong ratio of 0.5 instead of the correct ratio of 0.2 with autojunk enabled. a=""" #include <iostream> #include <string> using namespace std; int main() { string userPass; int sMaxIndex; char indivChar; int i; cin >> userPass; sMaxIndex = userPass.size() - 1; for (i = 0; i <= sMaxIndex; ++i) { indivChar = userPass.at(i); if (indivChar == 'i') { indivChar = '1'; cout << indivChar; } else if (indivChar == 'a') { indivChar = '@'; cout << indivChar; } else if (indivChar == 'm') { indivChar = 'M'; cout << indivChar; } else if (indivChar == 'B') { indivChar = '8'; cout << indivChar; } else if (indivChar == 's') { indivChar = '$'; cout << indivChar; } else { cout << indivChar; } } cout << "!" << endl; return 0; } """ b=""" #include <iostream> #include <string> using namespace std; int main() { string ori; cin >> ori; for (int i = 0; i < ori.size(); i++){ if (ori.at(i) == 'i') ori.at(i) = '1'; if (ori.at(i) == 'a') ori.at(i) = '@'; if (ori.at(i) == 'm') ori.at(i) = 'M'; if (ori.at(i) == 'B') ori.at(i) = '8'; if (ori.at(i) == 's') ori.at(i) = '$'; } cout << ori << endl; return 0; } """ ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45180> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com