A. c语言实现各位数字的相乘
C语言用这个,C++用楼上那个。
#include<stdio.h>
int main()
{
    int n, i;
     char c;
     printf("\n Please input an integer number (decimal), this program will get the proct of every digit of the number. End the input with \"Enter\".\n ");
     n=1;
     c=getchar();
    while(c !='\n')
    {  if(c<'0' || c>'9')
          {  printf("\n Error! The input is incorrect. The character input just now is not a digital. Finish.\n",n);
              return 0;
            }
         if(c=='0')
          {  printf("\n  The character input just now is \"0\", the proct is \"0\". No need to input more.\n Finish.\n",n);
              return 0;
            }
         n*=(int)(c-48);
         c=getchar();
      }
    printf("\n  The proct is \"%d\". \n Finish.\n", n);
    return 1;
}
B. c语言大整数乘法
scanf("%s%s",&a,&b);
我学两天C直接就学JAVA了。
说下我的看法吧。
a[i]-'0'
//a[i]比如i为10你里面都没赋值这个值我觉得是随机的,因为操作系统与编译器没必要对于所引用的地址进行操作。
而且减'0'虽然'0'可以转化成asc2码,但是这样做应该不行吧。。。
或者相乘超过了2的8次(c[i+j+1]不能存放这么多位,地址溢出)。
