Created
April 25, 2016 15:39
-
-
Save anonymous/5f4279b7cc8045a2a4cea36023d0c863 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Outputs the uppercase initials of a name | |
#include <stdio.h> | |
#include <cs50.h> | |
#include <string.h> | |
#include <ctype.h> | |
#define FIRSTLETTER 0 | |
int main(void) | |
{ | |
// Get user input | |
string name = GetString(); | |
// Print first letter of the name, then every letter preceeded by a blank character | |
printf("%c", toupper(name[FIRSTLETTER])); | |
for (int i = 0; i < strlen(name); i++) | |
if (isblank(name[i])) | |
printf("%c", toupper(name[i + 1])); | |
printf("\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment