1 | #include <iostream.hfa> |
---|
2 | #include <collections/string.hfa> |
---|
3 | #include <collections/string_res.hfa> |
---|
4 | |
---|
5 | |
---|
6 | void istream_cstr(void) { |
---|
7 | enum { size = 999, rsize = size - 1 }; // string size, read size |
---|
8 | char s1[size], s2[size], s3[size], si[size]; |
---|
9 | sin | wdi(size,rsize,s1) | wdi(size,rsize,s2) | wdi(size,rsize,s3); |
---|
10 | sout | s1; |
---|
11 | sout | s2; |
---|
12 | sout | s3; |
---|
13 | for(;;) { |
---|
14 | sin | wdi(size,rsize,si); |
---|
15 | if (si[0] == '=') break; |
---|
16 | sout | si; |
---|
17 | } |
---|
18 | } |
---|
19 | |
---|
20 | string accumulator; |
---|
21 | |
---|
22 | void reset_otherStringAction(void) { |
---|
23 | accumulator = ""; |
---|
24 | } |
---|
25 | void step_otherStringAction(void) { |
---|
26 | string localAction = "--"; |
---|
27 | accumulator += localAction(0,1); |
---|
28 | sout | accumulator; |
---|
29 | } |
---|
30 | |
---|
31 | void istream_string_res(void) { |
---|
32 | string_res s1, s2, s3, si; |
---|
33 | sin | s1 | s2 | s3; |
---|
34 | sout | s1; step_otherStringAction(); |
---|
35 | sout | s2; step_otherStringAction(); |
---|
36 | sout | s3; step_otherStringAction(); |
---|
37 | for(;;) { |
---|
38 | sin | si; |
---|
39 | if (size(si) > 0 && si[0] == '=') break; |
---|
40 | sout | si; step_otherStringAction(); |
---|
41 | } |
---|
42 | } |
---|
43 | |
---|
44 | void istream_string(void) { |
---|
45 | string s1, s2, s3, si; |
---|
46 | sin | s1 | s2 | s3; |
---|
47 | sout | s1; step_otherStringAction(); |
---|
48 | sout | s2; step_otherStringAction(); |
---|
49 | sout | s3; step_otherStringAction(); |
---|
50 | for(;;) { |
---|
51 | sin | si; |
---|
52 | if (size(si) > 0 && si[0] == '=') break; |
---|
53 | sout | si; step_otherStringAction(); |
---|
54 | } |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | int main() { |
---|
59 | istream_cstr(); sout | "="; |
---|
60 | istream_string_res(); sout | "="; reset_otherStringAction(); |
---|
61 | istream_string(); |
---|
62 | } |
---|