0

Check50 and I agree in the fact that my initials.c program exists and compiles. However, I am not getting the happy face for the next 5 tests of check50. The prompt of check 50 is this.

:( outputs "MB" for "Milo Banana"
    \ expected output, but not "MB"
:( outputs "MB" for "milo banana"
    \ expected output, but not "MB"
:( outputs "RTB" for "Robert Thomas Bowden"
    \ expected output, but not "RTB"
:( outputs "R" for "ROB"
    \ expected output, but not "R"
:( outputs "RTB" for "Robert thomas Bowden"
    \ expected output, but not "RTB"

My answers seem to match the correct ones but I'm not receiving good feedback.

I was watching the section of week 2 in search for some answers, but I did not find any clue on how to solve this.

Also, it might be useful to know, to answer my question, that my initials.c program prints each letter (initial) every iteration of a loop. The initials are not printed in one printf.

The output of the program looks like this:

jharvard@appliance (~/Dropbox/pset2): ./initials
milo banana
MBjharvard@appliance (~/Dropbox/pset2):


Where bold text is input from user.

2
  • I think that check50 checks literaly the result, that means that if you print something slightly different is going to say the result is wrong, that can be something like a space that is not suposed to be there or an unexpected new line at the end or at the begginig. Whithout seeing the code or the exact output its hard to tell what else can be wrong. But doesn't matter if you print the initials in separated printf() calls.
    – wallek876
    Feb 27 '15 at 17:35
  • I added the code and the output (I'm not sure if you meant that output.) Thank you for the quick response! Feb 27 '15 at 19:14
2

Yes, this output. Then i think the problem is obvious.

You print the initials and then the program ends and the command prompt apears in the same line than the initials.

This is a piece of the especifitations for the problem set:

Write, in a file called initials.c, a program that prompts a user for their name (using GetString to obtain their name as a string) and then outputs their initials in uppercase with no spaces or periods, followed by a newline (\n) and nothing more.

Your program is not printing the last new line or \n

Yo can see how the correct output looks like running the staff implementation of initials.c by executing this command on your terminal:

~cs50/pset2/initials
1
  • This solves the problem. Thank you so much you made my day
    – Chirag
    Jun 22 '17 at 4:35

You must log in to answer this question.

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