摘要:
思想:大数超出了计算机的整形表示范围,故一般用字符串记录,两个大数相加就不能简单的用“+”进行运算,得绕个弯。先把字符串转成int数组(借助与字符'0'的差来实现),每位都放在数组中,然后对数组进行按位加。#include <iostream>using namespace std;const int maxnum=20;void charTnum(int* intab,char *charab,int len)//字符串转整形,高低位倒置{ int i=0; for (i=0;i<len;i++) { intab[len-1-i]=charab[i]- 阅读全文
posted @ 2011-09-26 19:25
蔡諝
阅读(4139)
评论(0)
推荐(0)
浙公网安备 33010602011771号