#include "fstream.h" #include "vector_int.h" #include "array.h" #include "iterator.h" int main() { ofstream *sout = ofstream_stdout(); ifstream *sin = ifstream_stdin(); vector_int vec = vector_int_allocate(); // read in numbers until EOF or error int num; for ( ;; ) { sin >> # if ( fail( sin ) || eof( sin ) ) break; append( &vec, num ); } // write out the numbers sout << "Array elements:\n"; // write_all( begin( vec ), end( vec ), sout ); sout << "\n"; write_reverse( begin( vec ), end( vec ), sout ); sout << "\n"; for ( int index = 0; index <= last( vec ); index += 1 ) { sout << vec[ index ] << " "; } sout << "\n"; } // ../bin/cfa vector_test.c fstream.o iostream.o vector_int.o iterator.o array.o