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 fe3b61b was             17cd4eb, checked in by Peter A. Buhr <pabuhr@…>, 11 years ago | 
        
          | 
fixed restrict, fixed parameter copy, introduced name table for types, changed variable after to string
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            906 bytes | 
      
      
| Line |  | 
|---|
| 1 | #include "fstream.h" | 
|---|
| 2 | #include "vector_int.h" | 
|---|
| 3 | #include "array.h" | 
|---|
| 4 | #include "iterator.h" | 
|---|
| 5 |  | 
|---|
| 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 |  | 
|---|
| 14 | sout << "enter N elements and C-d on a separate line:\n"; | 
|---|
| 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 ); | 
|---|
| 24 | //    sout << "\n"; | 
|---|
| 25 | for ( int index = 0; index <= last( vec ); index += 1 ) { | 
|---|
| 26 | sout << vec[ index ] << " "; | 
|---|
| 27 | } | 
|---|
| 28 | sout << "\n"; | 
|---|
| 29 | #if 1 | 
|---|
| 30 | sout << "Array elements reversed:\n"; | 
|---|
| 31 | write_reverse( begin( vec ), end( vec ), sout ); | 
|---|
| 32 | sout << "\n"; | 
|---|
| 33 | #endif | 
|---|
| 34 | } | 
|---|
| 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.