#light let mathsPuzzle() = print_string "Enter day of the month on which you were born: " let input = read_int () let x = input * 4 // Multiply it by 4 let x = x + 13 // Add 13 let x = x * 25 // Multiply the result by 25 let x = x - 200 // Subtract 200 print_string "Enter number of the month you were born: " let input = read_int () let x = x + input let x = x * 2 // Multiply by 2 let x = x - 40 // Subtract 40 let x = x * 50 // Multiply the result by 50 print_string "Enter last two digits of the year of your birth: " let input = read_int () let x = x + input let x = x - 10500 // Finally, subtract 10,500 printf "Date of birth (ddmmyy): %i" x mathsPuzzle() 上述代码保存为samples.fs. 在F# Version 1.9.2.9 ;.Net Framework Version v2.0.50727环境下用fsc.exe编译器。
标签:F#
更新更新!
Name (required)
Mail (will not be published) (required)
Website
XHTML: 您可以使用这些标签: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
RSS Feed 订阅我: 鲜果, Google Reader, 抓虾, 有道, 或
不慌..不乱.. 请相信Pitt....
十二月 26th, 2007 at 8:03 上午
更新更新!