im having a problem with initials (More Confortable) in Pset2. The ckeck50 software outputs this:
: ( outputs "MB" for " milo banana "
\ expected output, but not "MB\u0000\n"
But when i try to run my program with that input i see no problem...
Thanks for your time!!
Here is my code
#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>
int main (void)
{
int i;
int j;
string name = get_string();
for (i = 0; i <= strlen(name); i++)
{
if(name[i] == ' ')
{
for(j = i; name[j] == ' '; j++);
putchar(toupper(name[j]));
i = j;
}
else if (i == 0)
putchar(toupper(name[i]));
}
putchar('\n');
}
And here is the check50 output:
~/workspace/pset2/initials/ $ check50 2016.initials.more initials.c
:) initials.c exists
:) initials.c compiles
:) outputs "MB" for "Milo Banana"
:) outputs "MB" for "milo banana"
:( outputs "MB" for " milo banana "
\ expected output, but not "MB\u0000\n"
:( outputs "MB" for " milo banana "
\ expected output, but not "MB\u0000\n"
:) outputs "RTB" for " robert thomas bowden"
:) outputs "RTB" for "Robert Thomas Bowden"
:) outputs "R" for "ROB"
:) outputs "RTB" for "Robert thomas Bowden"
https://sandbox.cs50.net/checks/393052e7d7d347a8b4df4b8e67766076
~/workspace/pset2/initials/ $ ./initials
milo banana
MB
Thanks a lot!