// // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // vector_test.c -- // // Author : Richard C. Bilson // Created On : Wed May 27 17:56:53 2015 // Last Modified By : Peter A. Buhr // Last Modified On : Thu Nov 19 17:54:34 2015 // Update Count : 9 // #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; sout << "enter N elements and C-d on a separate line:\n"; for ( ;; ) { sin >> # if ( fail( sin ) || eof( sin ) ) break; append( &vec, num ); } // write out the numbers sout << "Array elements:\n"; write( begin( vec ), end( vec ), sout ); sout << "\n"; sout << "Array elements reversed:\n"; write_reverse( begin( vec ), end( vec ), sout ); sout << "\n"; } // Local Variables: // // tab-width: 4 // // compile-command: "cfa vector_test.c fstream.o iostream.o vector_int.o iterator.o array.o" // // End: //