forked from pascalabcnet/pascalabcnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrite1.pas
34 lines (33 loc) · 831 Bytes
/
write1.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
uses System, System.IO, System.Text;
begin
var sb: StringBuilder := new StringBuilder();
var tw: TextWriter := new StringWriter(sb);
var stout := Console.Out;
Console.SetOut(tw);
writeln(23);
assert(sb.ToString()='23'+Environment.NewLine);
Console.Out.Flush();
sb.Clear();
write(23);
assert(sb.ToString()='23');
Console.Out.Flush();
sb.Clear();
write(2.3:3:2);
assert(sb.ToString()='2.30');
Console.Out.Flush();
sb.Clear();
write(4:3);
assert(sb.ToString()=' 4');
Console.Out.Flush();
sb.Clear();
write(45,23);
assert(sb.ToString()='4523');
Console.Out.Flush();
sb.Clear();
writeln('abc');
assert(sb.ToString()='abc'+Environment.NewLine);
writeln('def');
assert(sb.ToString()='abc'+Environment.NewLine+'def'+Environment.NewLine);
Console.Out.Flush();
sb.Clear();
end.