<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Function on Lin's Blog</title><link>http://coder.tw/tags/function/</link><description>Recent content in Function on Lin's Blog</description><generator>Hugo</generator><language>zh-tw</language><lastBuildDate>Wed, 05 Jan 2011 05:58:10 +0000</lastBuildDate><atom:link href="http://coder.tw/tags/function/index.xml" rel="self" type="application/rss+xml"/><item><title>【VB】【C++】計算n!(階層)</title><link>http://coder.tw/posts/vb-c-factorial-n-2/</link><pubDate>Wed, 05 Jan 2011 05:58:10 +0000</pubDate><guid>http://coder.tw/posts/vb-c-factorial-n-2/</guid><description>&lt;p&gt;&lt;a href="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2011/01/2011-01-05_054100.jpg"&gt;&lt;img class="alignnone size-large wp-image-4369" title="2011-01-05_054100" src="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2011/01/2011-01-05_054100-520x253.jpg" alt="" width="520" height="253" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;要計算n的階層是很簡單的一件事,會寫到這個程式是因為排列組合,我想要精確的知道答案會在幾種左右,因此就寫了n!的函數來幫忙求階層的值,所謂的階層就是指從1&lt;em&gt;2&lt;/em&gt;3&amp;hellip;..&lt;em&gt;n的意思,而在排列組合中如果要被排列的字有5個字,那麼排列後的結果就最多不超過5&lt;/em&gt;4&lt;em&gt;3&lt;/em&gt;2*1的值,也就是最多不超過120個答案&lt;/p&gt;
&lt;p&gt;以下我把n!做成Function,有VB版的跟C++版的,剛開始學迴圈的人可以用這個函式來學習迴圈的用法,另外因為擔心integer會存不下資料,所以我使用string來傳回資料,到時候用這個Function時要先把傳回值轉成數字型別才可以&lt;/p&gt;
&lt;h2&gt;</description></item></channel></rss>