??C++?????????
????????? ???????[ 2017/6/15 9:54:06 ] ??????????????????? C++
?????????????c++?????????????????????????????????????????е???????????????????????????????????????????????????????????????
????1????????????????????????????????????????????飬????????????????飬?????????????????????????????????????????????????????????ü???????ASCII????????48??
????2???????????????????????λ??????????????????鷴?????????????飬??????????????????????????
????3??????λ????????????????????????????????????????洧???????????????????????????
????4??????????????????????????????鷴??????????????????????????λ?????????????????????
?????????????????
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
char a1[100]??b1[100];
int a[100]??b[100]??c[100];
int a1_len??b1_len??lenc??i??x;
memset(a??0??sizeof(a));
memset(b??0??sizeof(b));
memset(c??0??sizeof(c));
gets(a1);
gets(b1); //?????????????
a1_len=strlen(a1);
b1_len=strlen(b1);
for (i=0;i<=a1_len-1;i++)
{
a[a1_len-i]=a1[i]-48; //????????????a????
}
for (i=0;i<=b1_len-1;i++)
{
b[b1_len-i]=b1[i]-48; //????????????b????
}
lenc =1;
x=0;
while(lenc <=a1_len || lenc <=b1_len)
{
c[lenc]=a[lenc]+b[lenc]+x; //???????
x=c[lenc]/10; //?????λ
c[lenc]=c[lenc]%10; //??λ?????
lenc++; //?????±??1
}
c[lenc]=x;
if (c[lenc]==0)
{
lenc--; //??????λ
}
for (i=lenc;i>=1;i--)
{
cout<<c[i]; //??????
}
cout<<endl;
return 0;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11