+ 1
No numeral challenge
Please, I don't seem to find solutions to this problem. It is always failing only Test Case #3 of the code coach. The problem is to convert any number found in the sentences inputted into word. Please what I'm I doing wrong? https://www.sololearn.com/coach/64?ref=app https://sololearn.com/compiler-playground/csaQV35S8Xwc/?ref=app
4 Antworten
+ 3
Oluwaseyi Aremu , what about the case for '10'. You commented this line of your code. Also it should be the first case in switch-case construction, otherwise '10' will be interpreted like 'one zero'. Hope it helps you.
+ 1
Oluwaseyi Aremu review case '10'. It is a mistake to place more than one character between single quotation marks, which are for single characters. You must change the way it tests for "10". Maybe under case '1' use if/else to check whether the next character is '0'. But you would have to check further that the character after that is non-numeric so it handles "100" correctly by not converting it.
Overall, the solution would work better to compare whole words instead of single characters.
TIP: Let cin break up the input into words like the code below. It reads a string until it encounters a blank space, i.e. it reads one word at a time.
string word;
while (cin >> word) {
...
}
+ 1
I've gotten a way around it and solved it.
It works for only ten thou.
Thanks Brian
0
Thanks for your assistance, I have tried it but still the same