# include & lt; String>
using namespace std;
The class BigInt
{
Private:
String bigint,
Public:
BigInt (string a="") {BigInt=a; }
Friend ostream & amp; Operator<(ostream & amp; OS, const BigInt & amp; A) {
OS & lt;
Friend istream& Operator> (cost & amp; The BigInt & amp; X)//input
{
Is & gt;> X.b igint;
The return is;
}
BigInt operator + (BigInt & amp; A)
{
String templong;
String tempshort;
Bool jinwei=false;
String sum;
If (a. igint. The size () & gt; Bigint. The size ()
{
Templong=a. igint;
Tempshort=bigint;
}
The else {
Templong=bigint;
Tempshort=a. igint;
} the for (int I=1; I & lt;=tempshort. The size (); I++)
{
Int l, s;
L=templong [templong. The size () - I] - '0';
S=tempshort [tempshort. The size () - I] - '0';
If (jinwei) {
Jinwei=false;
If (s + l + 1 & gt; 9) {
Jinwei=true;
Sum=to_string (10) (s + l + 1) % + sum;
}
The else {sum=to_string ((s + l + 1)) + sum; }
}
The else {
If ((s + l) & gt; 9) {
Jinwei=true;
Sum=to_string (10) (s + l) % + sum;
}
The else {sum=to_string ((s + l)) + sum; }
}
}
For (int I=tempshort. The size () + 1; I & lt;=templong. The size (); I++)
{
Int l;
L=templong [templong. The size () - I] - '0';
If (jinwei)
{jinwei=false;
If ((l + 1) & gt; 9)
{
Jinwei=true;
Sum=to_string (10) (l + 1) % + sum;
}
The else
{
Sum=to_string (l + 1) + sum;;
}
}
The else
{
Sum=to_string (l) + sum; }
}
Return BigInt (sum);
}
};
Int main () {
BigInt a, b, c;
cin> a> b;
C=a + b;
cout
}
Show me when I was in the pta this subject part right, but I couldn't think of the wrong place,,, and bosses, rectifying the wrong,
CodePudding user response:
At least explain the background of the problem, otherwise no one has time to help you debug codeCodePudding user response: