java - Adding Two Large Numbers Using Stacks -


i'm trying make program can add large numbers out of ordinary 8,330,103,343,234 , 5,123,342,345,231 or numbers based on user input. radical example. issues aside implementing stack class i'm not entirely sure on how user input numbers stack string. know i'll have make use of 2 stacks , possibly third 1 hold remainder of numbers.

i'm not entirely sure how handling user input, following might started in simple linear fashion (just example):

stack<biginteger> stack = new stack<biginteger>(); scanner scan = new scanner(system.in); system.out.print("enter number: "); biginteger bi = new biginteger(scan.next().trim()); stack.push(bi); system.out.print("enter number: "); bi = new biginteger(scan.next().trim()); stack.push(bi); system.out.println(stack.pop().add(stack.pop())); 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -