题目不重要,我想知道为啥没有输出
#include<iostream>
#include<cstdio>
#include<algorithm>
#include <string>
using namespace std;
struct Int
{
int a[1005];
void operator = (string s)
{
a[0] = s.size();
for (int i = 0; i < s.size(); i++)
{
a[a[0]-i] = s[i] - '0';
}
return;
}
Int operator + (Int B) {
Int C;
C.a[0] = 0;
for (int i = 1, g = 0; ; ++i) {
if (!g && i > a[0] && i > B.a[0])
break;
int x = g;
if (i <= a[0])
x += a[i];
if (i <= B.a[0])
x += B.a[i];
C.a[++C.a[0]] = x%10;
g = x/10;
}
return C;
}
};
ostream& operator << (ostream& out, Int x)
{
for (int i = x.a[0]; i >= 1; i--)
out << x.a[i];
return out;
}
istream& operator >> (istream& in, Int& x)
{
string s;
in >> s;
x = s;
return in;
}
int main() {
int l1, r1, l2, r2;
string s = "";
Int a, b;
cin >> l1 >> r1 >> l2 >> r2;
for (int i = r1; i <= l1; i++)
{
int t = i;
while (t)
{
s += t % 10 - '0';
t /= 10;
}
}
a = s;
s = "";
for (int i = r2; i <= l2; i++)
{
int t = i;
while (t)
{
s += t % 10 - '0';
t /= 10;
}
}
b = s;
Int c = a + b;
cout << c;
return 0;
}