dashujiecheng.rar

  • PUDN用户
    了解作者
  • Visual C++
    开发工具
  • 3KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 161
    下载次数
  • 2005-08-14 17:44
    上传日期
该源代码利用计算机模拟乘法竖式 计算阶乘 将每位数子保存在用new分配的一长字符数组里 在本人的机子上可计算30000!的精确值 用时近60秒
dashujiecheng.rar
  • www.pudn.com.txt
    218B
  • 阶乘.doc
    26.5KB
内容介绍
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <meta name="generator" content="pdf2htmlEX"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css"> <link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css"> <link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/626bf8e61e41a87e8aaa1dfb/raw.css"> <script src="https://static.pudn.com/base/js/compatibility.min.js"></script> <script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script> <script> try{ pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({}); }catch(e){} </script> <title></title> </head> <body> <div id="sidebar" style="display: none"> <div id="outline"> </div> </div> <div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/626bf8e61e41a87e8aaa1dfb/bg1.jpg"><div class="c x0 y1 w2 h2"><div class="t m0 x1 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">#include&lt;iostream&gt;</div><div class="t m0 x1 h3 y3 ff1 fs0 fc0 sc0 ls0 ws0">#include&lt;cmath&gt;</div><div class="t m0 x1 h3 y4 ff1 fs0 fc0 sc0 ls0 ws0">#include&lt;cstdlib&gt;</div><div class="t m0 x1 h3 y5 ff1 fs0 fc0 sc0 ls0 ws0">#include&lt;iomanip&gt;</div><div class="t m0 x1 h3 y6 ff1 fs0 fc0 sc0 ls0 ws0">using namespace std;</div><div class="t m0 x1 h3 y7 ff1 fs0 fc0 sc0 ls0 ws0">int getBitNum(int n);</div><div class="t m0 x1 h3 y8 ff1 fs0 fc0 sc0 ls0 ws0">int getN();</div><div class="t m0 x1 h3 y9 ff1 fs0 fc0 sc0 ls0 ws0">char*init(int size);</div><div class="t m0 x1 h3 ya ff1 fs0 fc0 sc0 ls0 ws0">void calc(char*a,int n);</div><div class="t m0 x1 h3 yb ff1 fs0 fc0 sc0 ls0 ws0">void display(char*a,int size);</div><div class="t m0 x1 h3 yc ff1 fs0 fc0 sc0 ls0 ws0">int main()</div><div class="t m0 x1 h3 yd ff1 fs0 fc0 sc0 ls0 ws0">{</div><div class="t m0 x2 h3 ye ff1 fs0 fc0 sc0 ls0 ws0">int n=getN();</div><div class="t m0 x2 h3 yf ff1 fs0 fc0 sc0 ls0 ws0">int size=getBitNum(n);</div><div class="t m0 x2 h3 y10 ff1 fs0 fc0 sc0 ls0 ws0">char*p=init(size);</div><div class="t m0 x2 h3 y11 ff1 fs0 fc0 sc0 ls0 ws0">calc(p,n);</div><div class="t m0 x2 h3 y12 ff1 fs0 fc0 sc0 ls0 ws0">display(p,size);</div><div class="t m0 x2 h3 y13 ff1 fs0 fc0 sc0 ls0 ws0">delete []p;</div><div class="t m0 x2 h3 y14 ff1 fs0 fc0 sc0 ls0 ws0">return 0;</div><div class="t m0 x1 h3 y15 ff1 fs0 fc0 sc0 ls0 ws0">}</div><div class="t m0 x1 h3 y16 ff1 fs0 fc0 sc0 ls0 ws0">int getN()</div><div class="t m0 x1 h3 y17 ff1 fs0 fc0 sc0 ls0 ws0">{</div><div class="t m0 x2 h3 y18 ff1 fs0 fc0 sc0 ls0 ws0">int n;</div><div class="t m0 x2 h3 y19 ff1 fs0 fc0 sc0 ls0 ws0">cin&gt;&gt;n;</div><div class="t m0 x2 h3 y1a ff1 fs0 fc0 sc0 ls0 ws0">while(n&lt;0)</div><div class="t m0 x2 h3 y1b ff1 fs0 fc0 sc0 ls0 ws0">{</div><div class="t m0 x3 h4 y1c ff1 fs0 fc0 sc0 ls0 ws0">cout&lt;&lt;"<span class="ff2">&#38750;&#27861;&#36755;&#20837;</span>!"&lt;&lt;endl;</div><div class="t m0 x3 h3 y1d ff1 fs0 fc0 sc0 ls0 ws0">cin&gt;&gt;n;</div><div class="t m0 x2 h3 y1e ff1 fs0 fc0 sc0 ls0 ws0">}</div><div class="t m0 x2 h3 y1f ff1 fs0 fc0 sc0 ls0 ws0">if(n==0)</div><div class="t m0 x3 h3 y20 ff1 fs0 fc0 sc0 ls0 ws0">exit(1);</div><div class="t m0 x2 h3 y21 ff1 fs0 fc0 sc0 ls0 ws0">return n;</div><div class="t m0 x1 h3 y22 ff1 fs0 fc0 sc0 ls0 ws0">}</div><div class="t m0 x1 h3 y23 ff1 fs0 fc0 sc0 ls0 ws0">int getBitNum(int n)</div><div class="t m0 x1 h3 y24 ff1 fs0 fc0 sc0 ls0 ws0">{</div><div class="t m0 x2 h3 y25 ff1 fs0 fc0 sc0 ls0 ws0">double sum=1;</div><div class="t m0 x2 h3 y26 ff1 fs0 fc0 sc0 ls0 ws0">for(int i=2;i&lt;=n;i++)</div><div class="t m0 x3 h3 y27 ff1 fs0 fc0 sc0 ls0 ws0">sum=sum+log10(long double(i));</div><div class="t m0 x2 h3 y28 ff1 fs0 fc0 sc0 ls0 ws0">return int(sum);</div><div class="t m0 x1 h3 y29 ff1 fs0 fc0 sc0 ls0 ws0">}</div><div class="t m0 x1 h3 y2a ff1 fs0 fc0 sc0 ls0 ws0">char*init(int size)</div><div class="t m0 x1 h3 y2b ff1 fs0 fc0 sc0 ls0 ws0">{</div><div class="t m0 x2 h3 y2c ff1 fs0 fc0 sc0 ls0 ws0">char*pa=new char[size];</div><div class="t m0 x2 h3 y2d ff1 fs0 fc0 sc0 ls0 ws0">if(!pa)</div></div></div><div class="pi" data-data='{"ctm":[1.611850,0.000000,0.000000,1.611850,0.000000,0.000000]}'></div></div> </body> </html>
评论
    相关推荐
    • LargeNumsCalculator.zip
      提供两个十进制数字字符串,并按位计算,模拟竖式计算。可实现超大数相加、相减、相乘(考虑到小数精度问题,除法暂不提供)。运用小学知识编程,最多可计算约 20 亿位数。参数不能为小数、负数、科学计数。
    • matlabcnhelp.rar
      matlab中文帮助很难找的,快速下载
    • MobilePolice.rar
      移动警察,车牌识别,车牌定位系统源代码,已经运用在移动车载稽查系统中。
    • SVM(matlab).rar
      支持向量机(SVM)实现的分类算法源码[matlab]
    • svm.zip
      用MATLAB编写的svm源程序,可以实现支持向量机,用于特征分类或提取
    • Classification-MatLab-Toolbox.rar
      模式识别matlab工具箱,包括SVM,ICA,PCA,NN等等模式识别算法,很有参考价值
    • VC++人脸定位实例.rar
      一个经典的人脸识别算法实例,提供人脸五官定位具体算法及两种实现流程.
    • QPSK_Simulink.rar
      QPSK的Matlab/Simulink的调制解调仿真系统,给出接收信号眼图及系统仿真误码率,包含载波恢复,匹配滤波,定时恢复等重要模块,帮助理解QPSK的系统
    • LPRBPDemo2009KV.rar
      车牌识别,神经网络算法,识别率高达95%,识别时间低于80ms。
    • MODULATION.RAR
      这个源程序代码包提供了通信系统中BPSK,QPSK,OQPSK,MSK,MSK2,GMSK,QAM,QAM16等调制解调方式 用matlab的实现,以及它们在AWGN和Rayleigh信道下的通信系统实现及误码率性能