⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_66237.htm

📁 vc
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:蓝欣 回复日期:2003-12-23 15:03:58
<br>内容:c:\sjx.cpp(41) : error C2065: 'exit' : undeclared identifier<BR>c:\sjx.cpp(21) : while compiling class-template member function 'int __thiscall Stack&lt;struct TreeNode&gt;::Push(TreeNode)'<BR>Error executing cl.exe.<BR><BR>这是什么错误啊?
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:林建华 回复日期:2003-12-23 15:17:45
<br>内容:exit没有定义<BR>编译类-模板成员函数'int __thiscall Stack&lt;struct TreeNode&gt;::Push(TreeNode)出错
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:蓝欣 回复日期:2003-12-23 15:21:46
<br>内容:我把exit(0)改为return 0可不可以啊,改后运行正常
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:林建华 回复日期:2003-12-23 16:10:00
<br>内容:可以的:)
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:蓝欣 回复日期:2003-12-23 18:54:48
<br>内容:呵呵<BR>谢谢了,还有那个大整数的问题能帮我解决吗?<BR>程序分为3个文件:bigint.h为类的定义文件,bigint.cpp为类方法定义文件,usebigint.cpp为实现文件<BR>在vc6.0下调试通过<BR><BR>//bigint.h<BR><BR>#ifndef BIGINT_H_<BR>#define BIGINT_H_<BR><BR>#include &lt;iostream.h&gt;<BR><BR>class Int<BR>{<BR>private:<BR>&nbsp;&nbsp;&nbsp;&nbsp;long int num;&nbsp;&nbsp;//这里不能满足要求啊,我需要的是自己能定义一个新的数据类型--大整数类型!能帮我把这个程序改进一下吗?<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int ();<BR>&nbsp;&nbsp;&nbsp;&nbsp;~Int ();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//重载 + - * /<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int operator+ ( const Int &amp; t ) const;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int operator- ( const Int &amp; t ) const;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int operator* ( const Int &amp; t ) const;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int operator/ ( const Int &amp; t ) const;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;friend void input ( Int &amp; t ) <BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cin &gt;&gt; t.num;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//return t;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;friend ostream &amp; operator&lt;&lt; ( ostream &amp; os, const Int &amp; t )<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;os &lt;&lt; t.num;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return os;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>};<BR><BR>#endif<BR><BR>//bigint.cpp<BR><BR>#include &#34;bigint.h&#34;<BR>#include &lt;iostream.h&gt;<BR><BR>Int :: Int ()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;num = 0;<BR>}<BR><BR>Int :: ~Int ()<BR>{}<BR><BR>Int Int :: operator+ ( const Int &amp; t ) const <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int temp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;temp.num = num + t.num;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return temp;<BR>}<BR><BR>Int Int :: operator- ( const Int &amp; t ) const<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int temp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;temp.num = num - t.num;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return temp;<BR>}<BR><BR>Int Int :: operator* ( const Int &amp; t ) const<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int temp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;temp.num = num * t.num;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return temp;<BR>}<BR><BR>Int Int :: operator/ ( const Int &amp; t ) const<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int temp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;temp.num = num / t.num;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return temp;<BR>}<BR><BR>//usebiging.cpp<BR><BR>#include &lt;iostream.h&gt;<BR>//using namespace std;<BR>#include &#34;bigint.h&#34;<BR><BR>int main()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int A;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int B;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Int temp;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; &#34;Please input number1: &#34;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;input( A );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//input number1<BR>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; &#34;Please input number2: &#34;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;input( B );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//input number2<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;temp = A + B;<BR>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; &#34;Number1 + Number2 = &#34; &lt;&lt; temp &lt;&lt; endl;<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;temp = A - B;<BR>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; &#34;Number1 - Number2 = &#34; &lt;&lt; temp &lt;&lt; endl;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;temp = A * B;<BR>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; &#34;Number1 * Number2 = &#34; &lt;&lt; temp &lt;&lt; endl;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;temp = A / B;<BR>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; &#34;Number1 / Number2 = &#34; &lt;&lt; temp &lt;&lt; endl;<BR>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; &#34;Done!\n&#34;;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;return 0;<BR>}
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:林建华 回复日期:2003-12-24 14:35:27
<br>内容:hehe ,定义一个数组不就是了啊:)<BR>等我的机器装好了给你一个:)
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:蓝欣 回复日期:2003-12-24 16:34:51
<br>内容:搞好了吗?<BR><BR>先谢谢啊,我们明天就要交作业了,现在还没搞好,郁闷啊!:(
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:林建华 回复日期:2003-12-25 11:22:52
<br>内容:不好意思,今天刚装好机器,但是那些测试代码都被格掉了:(<BR>我那个是用来计算n!的<BR>我用的是_int64 的数组,前32位作进位保存,后32位作实际结果<BR>加减法很简单,先对应的数组作运算,然后用进位区域的值作进位就可以了<BR>乘法每两个数组元素相乘,然后进位,然后调用加法就可以了<BR>除法的话有点麻烦,暂时没有好的办法
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -