ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
ctor
deferred_resn
demangler
enum
forall-pointer-decay
gc_noraii
jacob/cs343-translation
jenkins-sandbox
memory
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
string
with_gc
Last change
on this file since 2bae7307 was 843054c2, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago |
licencing: seventh groups of files
|
-
Property mode
set to
100644
|
File size:
906 bytes
|
Rev | Line | |
---|
[51b73452] | 1 | #include "fstream.h"
|
---|
| 2 | #include "vector_int.h"
|
---|
| 3 | #include "array.h"
|
---|
[134b86a] | 4 | #include "iterator.h"
|
---|
[51b73452] | 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
|
---|
[51b73452] | 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.