吴江那里有做公司网站的,it人力外包和项目外包,榆中建设局网站,wordpress 数据库 开发撸了一个半小时代码#xff0c;没玩守望#xff08;垃圾游戏毁我青春五个金牌都带不起队友#xff09;最后编译出312个错误。吓我#xff0c;然而改了几个地方就直接过了直接过了直接过了#xff0c;目前还是不明白ostream#xff0c;istream的用处#xff0c;上网才搞定… 撸了一个半小时代码没玩守望垃圾游戏毁我青春五个金牌都带不起队友最后编译出312个错误。吓我然而改了几个地方就直接过了直接过了直接过了目前还是不明白ostreamistream的用处上网才搞定的。只写了加与乘还有比较。其他后面加吧。减法跟除都很恶心。。。。 代码如下 1 #includeiostream2 #includecstdio3 #includecstring4 #includealgorithm5 #define maxn 50006 using namespace std;7 struct SPH{8 int len,s[maxn];9 SPH(){
10 memset(s,0,sizeof(s));
11 len1;
12 }
13 SPH operator (const char* num)
14 {
15 lenstrlen(num);
16 for(int i0;ilen;i) s[i]num[len-i-1]-48;
17 return *this;
18 }
19 SPH operator(const int num){
20 char a[maxn];
21 sprintf(a,%d,num);
22 *thisa;
23 return *this;
24 }
25 SPH (const int num){ *thisnum;
26 }
27 SPH (const char * num){ *thisnum;
28 }
29 SPH operator(const SPH a)
30 {
31 SPH c;
32 c.lenmax(len,a.len)1;
33 int x0;
34 for(int i0;ic.len;i)
35 {
36 c.s[i]s[i]a.s[i]x;
37 xc.s[i]/10;
38 c.s[i]c.s[i]%10;
39 }
40 if(c.s[c.len-1]0) --c.len;
41 return c;
42 }
43 SPH operator(const SPH a){
44 *this*thisa;
45 return *this;
46 }
47 SPH operator*(const SPH x){
48 SPH c;
49 c.lenlenx.len;
50 for(int i0;ilen;i){
51 for(int j0;jx.len;j){
52 c.s[ij]s[i]*x.s[j];
53 c.s[ij1]c.s[ij]/10;
54 c.s[ij]%10;
55 }
56
57 }
58 if(c.len-1) --c.len;
59 return c; }
60 SPH operator *(const SPH a){
61 *this*this * a;
62 return *this;
63 }
64 bool operator (const SPH x) const{
65 if(len !x.len) return lenx.len;
66 for(int ilen-1;i0;i--){
67 if(s[i]!x.s[i]) return s[i]x.s[i];
68 }
69 return false;}
70 bool operator (const SPH x) const {return x*this;}
71 bool operator (const SPH x) const {return !(x*this);}
72 bool operator (const SPH x) const {return !(x*this);}
73 bool operator (const SPH x) const {return !(x*this||x*this);}
74 bool operator !(const SPH x) const {return x*this||x*this;}
75 };
76 ostream operator (ostream out,const SPH x){
77 for(int ix.len-1;i0;i--)
78 coutx.s[i];
79 return out;
80 }
81 istream operator (istream in,SPH x)
82 {
83 char num[maxn];
84 innum;
85 xnum;
86 return in;
87 }
88
89 int main()
90 {
91 SPH n,m,sum;
92 cinnm;
93 sumnm;
94 coutsum ;
95 sumn*m;
96 coutsum;
97 return 0;
98 } 转载于:https://www.cnblogs.com/srpihot/p/6379910.html