Path: utzoo!attcan!uunet!lll-winken!ames!amdahl!pacbell!att!alberta!dvinci!lowey From: lowey@dvinci.USask.CA (Kevin Lowey) Newsgroups: comp.lang.pascal Subject: Re: Variable length output with Write(ln) inTurbo Pascal 5.0 Summary: Use WRITE!!! Message-ID: <1640@dvinci.USask.CA> Date: 16 Jan 89 03:13:18 GMT References: <1779@pur-phy> Organization: University of Saskatchewan Lines: 42 In article <1779@pur-phy>, murphy@pur-phy (William J. Murphy) writes: > Does anyone know of a way using Write or Writeln to output a variable > length set of variables on a *single* line? I don't understand. If you use WRITE, then it does not add an end of line character. The next write or writeln will continue on the same line, not at the beginning of the next line. For example: Write ('One, '); Write ('Two, '); write ('Three.'); would create an output line of One, Two, Three. Is this what you want? > Can I control whether Write or Writeln print out a carriage return line > feed? WRITE does not put the CR/LF, writeln does. If you want to control exactly what characters are output, you could use the CHR function to convert an ASCII code of a number into the actual character. You could then get an explicit CR/LF with the following statement: write (chr(13),chr(10)); > > In C you could write > for(i =0; i printf("%d ",max[i]); > printf("\n"); > > So, how do you do it in Pascal? for i := 0 to (N-1) do begin write (max[i],' '); end; writeln; -- Kevin Lowey