0
no numerals code coach failing test case 3
why is this code failing text case 3 #include <iostream> int main() { std::string input{}; std::getline(std::cin , input ); std::string num[]{"0","1","2","3","4","5","6","7","8","9","10"}; std::string word[]{"zero","one","two","three","four","five","six","seven","eight","nine","ten"}; for(int x=0; x < 11; x++){ while(input.find(num[x]) != -1){ int pos = input.find(num[x]); input.replace(pos , num[x].length() , word[x]); } } std::cout << input ; return 0; }
2 ответов
+ 2
Think about what your code does when replacing 10.
+ 2
(👉゚ヮ゚)👉 Fix your coding errors
https://www.sololearn.com/compiler-playground/cb4v42687mix