2nd Attempt : CS50 PSet2_Initializing

11:18:00 AM

Here's how I did on my second attempt with the help of my "secret personal TA".

I approached the problem with if, else if instead of argv[  ][  ]. The picture showed how it check out -- still with a lot of errors. Then I just simply added printf("\n"), and everything just checked out.































My pseudo-code is the following:

get user's input
for (conditions for the computer to run the whole string)
    if (it's the first character of the string)
    print the character out in uppercase
    else if (there is a space)
    print the next character while following the space out in uppercase
print new line


What I learned?
1. inculde <ctype.h> , then we can use "toupper()" to make characters typed in uppercase
2. There are obviously more than one way to write a program. How you write codes depends on what the requirement is. Sometimes the easier approach might not fit the requirements. 
 

You Might Also Like

0 comments

Popular Posts

Like us on Facebook

Flickr Images

Subscribe