source:
src/tests/vector_test.c@
c6467b6
      
      | Last change on this file since c6467b6 was 1e37d4d, checked in by , 9 years ago | |
|---|---|
| 
 | |
| File size: 1.1 KB | |
| Rev | Line | |
|---|---|---|
| [86bd7c1f] | 1 | // | 
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo | |
| 3 | // | |
| 4 | // The contents of this file are covered under the licence agreement in the | |
| 5 | // file "LICENCE" distributed with Cforall. | |
| 6 | // | |
| [eab39cd] | 7 | // vector_test.c -- | 
| [86bd7c1f] | 8 | // | 
| 9 | // Author : Richard C. Bilson | |
| 10 | // Created On : Wed May 27 17:56:53 2015 | |
| [eab39cd] | 11 | // Last Modified By : Rob Schluntz | 
| [1ad1c99e] | 12 | // Last Modified On : Wed Apr 27 17:31:27 2016 | 
| [6ba0659] | 13 | // Update Count : 18 | 
| [86bd7c1f] | 14 | // | 
| 15 | ||
| [d3b7937] | 16 | #include <fstream> | 
| 17 | #include <iterator> | |
| [51b73452] | 18 | #include "vector_int.h" | 
| 19 | #include "array.h" | |
| 20 | ||
| [784deab] | 21 | int main( void ) { | 
| [eab39cd] | 22 | vector_int vec; | 
| [134b86a] | 23 | |
| [86bd7c1f] | 24 | // read in numbers until EOF or error | 
| 25 | int num; | |
| [134b86a] | 26 | |
| [cf16f94] | 27 | sout | "enter N elements and C-d on a separate line:" | endl; | 
| [86bd7c1f] | 28 | for ( ;; ) { | 
| [cf16f94] | 29 | sin | # | 
| [86bd7c1f] | 30 | if ( fail( sin ) || eof( sin ) ) break; | 
| [e56cfdb0] | 31 | append( &vec, num ); | 
| [86bd7c1f] | 32 | } | 
| 33 | // write out the numbers | |
| [134b86a] | 34 | |
| [cf16f94] | 35 | sout | "Array elements:" | endl; | 
| [1ad1c99e] | 36 | write( begin( &vec ), end( &vec ), sout ); | 
| [cf16f94] | 37 | sout | endl; | 
| [e56cfdb0] | 38 | |
| [cf16f94] | 39 | sout | "Array elements reversed:" | endl; | 
| [1ad1c99e] | 40 | write_reverse( begin( &vec ), end( &vec ), sout ); | 
| [cf16f94] | 41 | sout | endl; | 
| [51b73452] | 42 | } | 
| [134b86a] | 43 | |
| [86bd7c1f] | 44 | // Local Variables: // | 
| 45 | // tab-width: 4 // | |
| [d3b7937] | 46 | // compile-command: "cfa vector_test.c vector_int.o array.o" // | 
| [86bd7c1f] | 47 | // End: // | 
  Note:
 See   TracBrowser
 for help on using the repository browser.
    