function addingmachine,double=double ;+ ; ; ADDINGMACHINE ; A command-line function that acts as a simple adding machine by ; taking a sequence of single numbers from user input and adding them ; together, printing a running total. ; ; Syntax: ; Result = ADDINGMACHINE([/DOUBLE]) ; ; Keyword: ; DOUBLE - Set to require double precision. ; ; Katie Peek / November 2007 ; Future work: Add a /printreceipt keyword to keep track of history? ; ;- print,' Enter values to add to displayed total. Exit by entering "x"' if keyword_set(double) then sum=0.0d else sum=0.0 a='0' while (a ne 'x') do begin if keyword_set(double) then aa = double(a) else aa=float(a) sum = sum + aa read,a,prompt=' '+str(sum)+' + ' endwhile return, sum end