ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since 52ac3b4 was
843054c2,
checked in by Peter A. Buhr <pabuhr@…>, 9 years ago
|
licencing: seventh groups of files
|
-
Property mode set to
100644
|
File size:
906 bytes
|
Rev | Line | |
---|
[51b7345] | 1 | #include "fstream.h" |
---|
| 2 | #include "vector_int.h" |
---|
| 3 | #include "array.h" |
---|
[134b86a] | 4 | #include "iterator.h" |
---|
[51b7345] | 5 | |
---|
[134b86a] | 6 | int main() { |
---|
| 7 | ofstream *sout = ofstream_stdout(); |
---|
| 8 | ifstream *sin = ifstream_stdin(); |
---|
| 9 | vector_int vec = vector_int_allocate(); |
---|
| 10 | |
---|
| 11 | // read in numbers until EOF or error |
---|
| 12 | int num; |
---|
| 13 | |
---|
[d11f789] | 14 | sout << "enter N elements and C-d on a separate line:\n"; |
---|
[134b86a] | 15 | for ( ;; ) { |
---|
| 16 | sin >> # |
---|
| 17 | if ( fail( sin ) || eof( sin ) ) break; |
---|
| 18 | append( &vec, num ); |
---|
| 19 | } |
---|
| 20 | // write out the numbers |
---|
| 21 | |
---|
| 22 | sout << "Array elements:\n"; |
---|
| 23 | // write_all( begin( vec ), end( vec ), sout ); |
---|
[17cd4eb] | 24 | // sout << "\n"; |
---|
[134b86a] | 25 | for ( int index = 0; index <= last( vec ); index += 1 ) { |
---|
| 26 | sout << vec[ index ] << " "; |
---|
| 27 | } |
---|
| 28 | sout << "\n"; |
---|
[17cd4eb] | 29 | #if 1 |
---|
| 30 | sout << "Array elements reversed:\n"; |
---|
| 31 | write_reverse( begin( vec ), end( vec ), sout ); |
---|
| 32 | sout << "\n"; |
---|
| 33 | #endif |
---|
[51b7345] | 34 | } |
---|
[134b86a] | 35 | |
---|
| 36 | // ../bin/cfa vector_test.c fstream.o iostream.o vector_int.o iterator.o array.o |
---|
Note: See
TracBrowser
for help on using the repository browser.