高精度加高精度
1 void BigAddBig(char *a, char *b, char *c) 2 { 3 //a表示结果,b,c位加数 4 int a_int[1005] = { 0 }, b_int[1005] = { 0 }, c_int[1005] = { 0 }; 5 int len1, len2, len, i; 6 len1 = strlen(b); 7 len2 = strlen(c); 8 for (i = 0; i < len1; i++) 9 b_int[i] = b[len1 - 1 - i] - '0'; 10 for (i = 0; i<len2; i++) 11 c_int[i] = c[len2 - 1 - i] - '0'; 12 len = len1>len2 ? len1 : len2; 13 for (i = 0; i<len; i++) 14 { 15 a_int[i] += b_int[i] + c_int[i]; 16 if (a_int[i]>9) 17 { 18 a_int[i + 1] = a_int[i] / 10; 19 a_int[i] = a_int[i] % 10; 20 } 21 } 22 if (a_int[i] != 0) 23 len++; 24 while (!a_int[len - 1]) 25 len--; 26 for (i = 0; i < len; i++) 27 a[i] = a_int[len - 1 - i] + '0'; 28 a[i] = '