資源簡介
GarbaGe的東西降價(jià)了?。?!一分,就一分?。?!好東西一定要分享啊啊?。。?!
本模板為高精度模板,大概可存儲(chǔ)200位。
目前只支持:輸入、輸出、賦值、加法。
會(huì)不定期更新,請(qǐng)多多資瓷!
代碼片段和文件信息
#include
#include
#include
#include
using?namespace?std;
struct?BigInteger?{
??static?const?int?base?=?100000000;
??static?const?int?WIDTH?=?8;
??vector?s;
??BigInteger(long?long?num?=?0)?{?*this?=?num;?}?//?構(gòu)造函數(shù)
??BigInteger?operator?=?(long?long?num)?{?//?賦值運(yùn)算符
????s.clear();
????do?{
??????s.push_back(num?%?base);
??????num?/=?base;
????}?while(num?>?0);
????return?*this;
??}
??BigInteger?operator?=?(const?string&?str)?{?//?賦值運(yùn)算符
????s.clear();
????int?x?len?=?(str.length()?-?1)?/?WIDTH?+?1;
????for(int?i?=?0;?i???????int?end?=?str.length()?-?i*WIDTH;
??????int?start?=?max(0?end?-?WIDTH);
??????sscanf(str.substr(start?end-start).c_str()?“%d“?&x);
??????s.push_back(x);
????}
????return?*this;
??}
- 上一篇:DAC8552生成正弦波程序
- 下一篇:猜數(shù)游戲。c語言
評(píng)論
共有 條評(píng)論