Message
Message
h>
#include <stdlib.h>
#include <string.h>
typedef struct {
int top;
unsigned long long int* stack;
} Stack;
int i;
int carry = 0;
while (!isEmpty(&stack1) || !isEmpty(&stack2)) {
unsigned long long int digit1 = isEmpty(&stack1) ? 0 : pop(&stack1);
unsigned long long int digit2 = isEmpty(&stack2) ? 0 : pop(&stack2);
unsigned long long int sum = digit1 + digit2 + carry;
carry = sum / 10;
unsigned long long int digit = sum % 10;
push(&resultStack, digit);
}
if (carry > 0) {
push(&resultStack, carry);
}
i = 0;
while (!isEmpty(&resultStack)) {
result[i++] = pop(&resultStack) + '0';
}
result[i] = '\0';
free(stack1.stack);
free(stack2.stack);
free(resultStack.stack);
}
int main() {
FILE* file1 = fopen("WE1.TXT", "r");
FILE* file2 = fopen("WE2.TXT", "r");
FILE* output = fopen("WY.TXT", "w");
char num1[100];
char num2[100];
char result[101];
fclose(file1);
fclose(file2);
fclose(output);
return 0;
}