New answers tagged

0

After getting replies (also on CS50 eDX forum) and reworking, here is the code that seems to achieve the intermittent goal of finding ASCII code of entered characters. There was no need of while loop and it was an error as the same leads to infinite loop. Even if there was a need, I should perhaps have opted for if command. #include<stdio.h> #include&...


0

I think the question from DinoCoderSaurus answers the question. Have you tried compiling again, since making that correction?


0

what is the plain text that you did input though? what's special about the fifth character, I assume it'd be a non alphabetic character since you don't seem to have added an else for that case


0

It's only supposed to terminate the program with the usage message, not prompt for a new key. The real problem here is that it will only check the first character. Think about it. If a single char is not a number, the test fails and the program needs to terminate. BUT, it's only a success once all the characters are checked. The code needs to check all the ...


1

It does this because of the logic that was implemented in the code. Think about what the code does. Even though it's running a loop, the code is going to check the first character in the input string. Whether it's a number or not, it's going to terminate because of the return statements in both if statements. A return statement in main will immediately ...


Top 50 recent answers are included