📄 subject_66237.htm
字号:
<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<struct TreeNode>::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<struct TreeNode>::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 <iostream.h><BR><BR>class Int<BR>{<BR>private:<BR> long int num; //这里不能满足要求啊,我需要的是自己能定义一个新的数据类型--大整数类型!能帮我把这个程序改进一下吗?<BR> <BR>public:<BR> Int ();<BR> ~Int ();<BR> //重载 + - * /<BR> Int operator+ ( const Int & t ) const;<BR> Int operator- ( const Int & t ) const;<BR> Int operator* ( const Int & t ) const;<BR> Int operator/ ( const Int & t ) const;<BR><BR> friend void input ( Int & t ) <BR> {<BR> cin >> t.num;<BR> //return t;<BR> }<BR> <BR> friend ostream & operator<< ( ostream & os, const Int & t )<BR> {<BR> os << t.num;<BR> return os;<BR> }<BR>};<BR><BR>#endif<BR><BR>//bigint.cpp<BR><BR>#include "bigint.h"<BR>#include <iostream.h><BR><BR>Int :: Int ()<BR>{<BR> num = 0;<BR>}<BR><BR>Int :: ~Int ()<BR>{}<BR><BR>Int Int :: operator+ ( const Int & t ) const <BR>{<BR> Int temp;<BR> temp.num = num + t.num;<BR> return temp;<BR>}<BR><BR>Int Int :: operator- ( const Int & t ) const<BR>{<BR> Int temp;<BR> temp.num = num - t.num;<BR> return temp;<BR>}<BR><BR>Int Int :: operator* ( const Int & t ) const<BR>{<BR> Int temp;<BR> temp.num = num * t.num;<BR> return temp;<BR>}<BR><BR>Int Int :: operator/ ( const Int & t ) const<BR>{<BR> Int temp;<BR> temp.num = num / t.num;<BR> return temp;<BR>}<BR><BR>//usebiging.cpp<BR><BR>#include <iostream.h><BR>//using namespace std;<BR>#include "bigint.h"<BR><BR>int main()<BR>{<BR> Int A;<BR> Int B;<BR> Int temp;<BR><BR> cout << "Please input number1: ";<BR> input( A ); //input number1<BR> cout << "Please input number2: ";<BR> input( B ); //input number2<BR> <BR> temp = A + B;<BR> cout << "Number1 + Number2 = " << temp << endl;<BR> <BR> temp = A - B;<BR> cout << "Number1 - Number2 = " << temp << endl;<BR><BR> temp = A * B;<BR> cout << "Number1 * Number2 = " << temp << endl;<BR><BR> temp = A / B;<BR> cout << "Number1 / Number2 = " << temp << endl;<BR> cout << "Done!\n"; <BR> 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 + -