0

So, I have finished the program and it works as it should, displays everything identically to the staff one. However, when I use the corrector to check for errors it seems to glitch, have a look:

:) initials.c exists

:) initials.c compiles

:( outputs "MB" for "Milo Banana"

\ expected output, but not "-B\n"

:) outputs "MB" for "milo banana"

:( outputs "RTB" for "Robert Thomas Bowden" \ expected output, but not "2TB\n"

:( outputs "R" for "ROB" \ expected output, but not "2\n"

:( outputs "RTB" for "Robert thomas Bowden" \ expected output, but not "2TB\n"

Taking the last one for example, you can see quite clearly that the output was RTB, (and I tested manually to make sure), but afterwards the corrector takes it as "2TB\n". Why could that be? Yes, I've tried removing the \n, doesn't make a difference.

Thanks a bunch

1 Answer 1

1

I'm confident that check50 is working correctly after the thousands and thousands of times it has been run. So, without seeing your code, there's no way to know, but I have a theory. Every test that fails has three things in common.

  1. It's always and only a first letter that is in error.
  2. The first letter in the name is always already upper case.
  3. The resulting error always has an ASCII value exactly 32 less than the original letter.

So, how are you processing the first letter and how are you capitalizing? I'll bet that you're capitalizing by subtracting 32 from a lowercase letter. I'll also bet that you have a bug in your code for handling the first letter. BTW, are you familiar with toupper()?

That should give you something to think about. ;-)

IF this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

1
  • You were right, I had a bug when handling the first letter. Very well observed. Thank you for your help, I'll pay more attention in the future. Commented Feb 21, 2016 at 18:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .