-- Example for standard input and redirection
-- Get with no file parameter reads from standard input
-- By default standard input reads from the keyboard
-- To cause standard input to come from a file, use redirection.
-- To cause this program to read from somefile.txt, do this:
-- Make sure that the data file ends with an integer or an eof error
-- may be raised

--   stdin < somefile.txt

with ada.text_io; use ada.text_io; 
with ada.integer_text_io; use ada.integer_text_io; 
 
procedure stdin  is 
    n: Natural;
    s: Natural := 0;
begin
    while not end_of_file loop
        get(n);
        put_line(n'img);
        s := s + n;
    end loop;
    put_line(s'img);

end stdin;
-- Contents of file somefile.txt: 3 4 5
-- Execution:  stdin < somefile.txt
-- Output:
--|          3
--|          4
--|          5
--|         12