Thursday, March 17, 2011

Happy St. Patricks day!

First one to answer the above trivia question in the comments section gets a DCF T-shirt!

Todays workout was:
"Angie"
100 pullups
100 pushups
100 situps
100 squats



4 comments:

  1. Haley,
    Are you sure it is not supposed to read

    if(!(strcmp(words, "jump))

    ?

    That would mean if the words equals jump, then you print how high. But then you call the function jump with an uninitialized "i"!!

    /narayan

    ReplyDelete
  2. +1 to narayan's comments :P The code doesn't work.

    cyn

    ReplyDelete
  3. I must have reproduced it incorrectly. See how smart you guys are? :-)

    ReplyDelete
  4. I think the code would be broken by the (mis)placement of {}-brackets. The logic looks sound to me. The atoi function converts a string to integer, and if that integer is greater than zero, then jump(i) begins to happen.

    The validity of the strcmp call depends on your programming language. I think in C/C++ you would want the '!' for a logic inversion but in Matlab strcmp returns the index of where 'jump' is located within words, so in Matlab that if-statement would be OK as-is (although Matlab likes single quotes for strings).

    ReplyDelete