30 lines
		
	
	
	
		
			841 B
		
	
	
	
		
			Modula-2
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			841 B
		
	
	
	
		
			Modula-2
		
	
	
	
	
	
DEFINITION MODULE RealInOut;
 | 
						|
(*
 | 
						|
  Module:	InOut for REAL numbers
 | 
						|
  From:		"Programming in Modula-2", 3rd, corrected edition, by N. Wirth
 | 
						|
  Version:	$Header$
 | 
						|
*)
 | 
						|
 | 
						|
  VAR Done: BOOLEAN;
 | 
						|
 | 
						|
  PROCEDURE ReadReal(VAR x: REAL);
 | 
						|
  (* Read a real number "x" according to the syntax:
 | 
						|
     
 | 
						|
	['+'|'-'] digit {digit} ['.' digit {digit}]
 | 
						|
	[('E'|'e') ['+'|'-'] digit {digit}]
 | 
						|
 | 
						|
     Done := "a number was read".
 | 
						|
     Input terminates with a blank or any control character.
 | 
						|
     When reading from a terminal, backspacing may be done by either
 | 
						|
     DEL or BACKSPACE, depending on the implementation of ReadString.
 | 
						|
  *)
 | 
						|
 | 
						|
  PROCEDURE WriteReal(x: REAL; n: CARDINAL);
 | 
						|
  (* Write x using n characters.
 | 
						|
     If fewer than n characters are needed, leading blanks are inserted.
 | 
						|
  *)
 | 
						|
 | 
						|
  PROCEDURE WriteRealOct(x: REAL);
 | 
						|
  (* Write x in octal words.
 | 
						|
  *)
 | 
						|
END RealInOut.
 |