Category: California

Oct 04 2010

Torrey Pines

This is Torrey Pines. So beautiful. I think I might find a place close to here to live. Any objections?

Sep 29 2010

Programming in Objective-C, Chapter 6, Exercise 6

On the road I’ve been studying Objective-C as something to do. But I came across this problem in the book and it took me about a day to figure out. I tried to research it on the internet, but there was no answer that could satisfy the requirements of the program. A lot of them started using arrays, which has not been introduced, so only using loops and decisions can be made. I was able to get the hard part of the program done. So I left out the number 0 and any negative numbers, which is easy once you have this hard part figured out. Good luck on your programming adventures!

Ch06Prob06:

Write a program that takes an integer keyed in from the terminal and extracts and displays each digit of the integer in English. So if the user types in 932, the program should display the following:

nine
three
two

(Remember to display zero if the user types in just 0.) Note: This exercise is a hard one!

—–

#import

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

int number, count_digits, result, original_number, p;

NSLog (@”Enter your number.”);
scanf (“%i”, &number);

original_number = number;

// this counts the number of digits minus 1

do {
number /= 10;
++count_digits;
}
while (number / 10 !=0);

// this looks at the digits from left to right

for (p=count_digits; p>=0; – -p)
{
result = original_number / pow(10,count_digits);
- -count_digits;

switch (result%10){
case 1:
NSLog (@”one”);
break;
case 2:
NSLog (@”two”);
break;
case 3:
NSLog (@”three”);
break;
case 4:
NSLog (@”four”);
break;
case 5:
NSLog (@”five”);
break;
case 6:
NSLog (@”six”);
break;
case 7:
NSLog (@”seven”);
break;
case 8:
NSLog (@”eight”);
break;
case 9:
NSLog (@”nine”);
break;
}
}

[pool drain];
return 0;
}

Sep 11 2010

Pier 39

Pier 39 is pretty cool. I saw lots of stinky seals, Golden Gate bridge, Alcatraz and a huge macaroni noodle!!! Sorry the pictures are crappy. Phone doesn’t have a zoom. There was also a secret agent I saw in the bushes too. I didn’t get a picture of him since he was currently at work.

Sep 10 2010

San Francisco Street Rails

These rail cars run all over downtown San Francisco. I even rode in front and hanging out the side! “Riiiiiice A Roniiiii!….”

Sep 06 2010

Pinwheels!

California sure knows how to make Mother Nature work!

WordPress Themes