This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
hi, my initials program is failing the cs50 check even when the output is the correct one, I know my code is not probably the best solution, but it works. Thanks in advance for any help.
int main (void) {
string userName;
printf("Write your full name:\n");
userName = get_string();
char space = ' ';
if (userName != NULL) {
printf("%c", toupper(userName[0]));
for (int i =1, length = strlen(userName); i < length ; i ) {
if ( userName[i] == space) {
printf ("%c",toupper(userName[i 1]));
}
}
printf("\n");
}
}
this is the result of the cs50 check:
:) initials.c exists :) initials.c compiles :( outputs "MB" for "Milo Banana" \ expected prompt for input, not output of "Write your full name:\n" :( outputs "MB" for "milo banana" \ expected prompt for input, not output of "Write your full name:\n" :( outputs "RTB" for "Robert Thomas Bowden" \ expected prompt for input, not output of "Write your full name:\n" :( outputs "R" for "ROB" \ expected prompt for input, not output of "Write your full name:\n" :( outputs "RTB" for "Robert thomas Bowden" \ expected prompt for input, not output of "Write your full name:\n"
Subreddit
Post Details
- Posted
- 7 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/cs50/commen...