I am currently making a program at school where I have to accept two unsigned integers of unlimited length and add them together, then output the sum. My teacher wants us to only use linked lists or stacks and he said we cannot use arrays, STL, or strings. My thought process was to use a for loop to push every number inputted into the stack, but after trying it, it seemed to be very inefficient. I was wondering if any of you had any suggestions of how I could store the integers in a stack or linked list or if what I was already doing was the best way. Thanks.
Aucun commentaire:
Enregistrer un commentaire