回复 10楼 寒墨轩
类似于学生管理系统的简单的大概几十行代码~
[code]/*~个性签名:bug是什么意思?bug是看上去没有可能的东西实际上是有可能做到的 就是这样~2018-08-08更~*/[/code]
#include <stdio.h> #include <string.h> #include <stdlib.h> #define N 15 void jiafa(char a[], char b[], int f[]); int main() { int i = 0; char a[N] = { 0 }, b[N] = { 0 }; int f[N] = { 0 }; printf("please inter a[]:"); gets(a); printf("please inter b[]:"); gets(b); jiafa(a, b, f); int *p = f; while (*p == 0) p++; while (p !=(f+15)) printf("%d", *p++); system("pause"); return 0; } void jiafa(char a[], char b[], int f[]) { int i, lena, lenb,j; int d[N] = { 0 }; int e[N] = { 0 }; //int f[N]; lena = strlen(a); for (i = 0; i < lena; i++) { d[N - 1 - i] = a[lena-i-1] - '0'; } lenb = strlen(b); for (i = 0; i < lenb; i++) { e[N - 1 - i] = b[lenb-i-1] - '0'; } for (i = 0; i < N; i++) { f[N - i - 1] = f[N-i-1] + d[N - i - 1] + e[N - 1 - i]; for ( j= 0; j < N; j++) { if (f[N - 1 - j] >= 10) { f[N - j - 1] = f[N - j - 1] % 10; f[N - j - 2] += 1; } } } }