ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        resolv-new
        with_gc
      
      
        
          | 
            Last change
 on this file since ad51cc2 was             7bc4e6b, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago           | 
        
        
          | 
             
change iostream to use references, and update affected tests 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.1 KB
           | 
        
      
      
| Line |   | 
|---|
| 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 | //
 | 
|---|
| 7 | // vector_test.c --
 | 
|---|
| 8 | //
 | 
|---|
| 9 | // Author           : Richard C. Bilson
 | 
|---|
| 10 | // Created On       : Wed May 27 17:56:53 2015
 | 
|---|
| 11 | // Last Modified By : Peter A. Buhr
 | 
|---|
| 12 | // Last Modified On : Thu Aug 24 08:15:38 2017
 | 
|---|
| 13 | // Update Count     : 19
 | 
|---|
| 14 | //
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include <fstream>
 | 
|---|
| 17 | #include <iterator>
 | 
|---|
| 18 | #include "vector_int.h"
 | 
|---|
| 19 | #include "array.h"
 | 
|---|
| 20 | 
 | 
|---|
| 21 | int main( void ) {
 | 
|---|
| 22 |         vector_int vec;
 | 
|---|
| 23 | 
 | 
|---|
| 24 |         // read in numbers until EOF or error
 | 
|---|
| 25 |         int num;
 | 
|---|
| 26 | 
 | 
|---|
| 27 |         sout | "enter N elements and C-d on a separate line:" | endl;
 | 
|---|
| 28 |         for ( ;; ) {
 | 
|---|
| 29 |                 sin | num;
 | 
|---|
| 30 |           if ( fail( sin ) || eof( sin ) ) break;
 | 
|---|
| 31 |                 append( &vec, num );
 | 
|---|
| 32 |         }
 | 
|---|
| 33 |         // write out the numbers
 | 
|---|
| 34 | 
 | 
|---|
| 35 |         sout | "Array elements:" | endl;
 | 
|---|
| 36 |         write( begin( &vec ), end( &vec ), sout );
 | 
|---|
| 37 |         sout | endl;
 | 
|---|
| 38 | 
 | 
|---|
| 39 |         sout | "Array elements reversed:" | endl;
 | 
|---|
| 40 |         write_reverse( begin( &vec ), end( &vec ), sout );
 | 
|---|
| 41 |         sout | endl;
 | 
|---|
| 42 | }
 | 
|---|
| 43 | 
 | 
|---|
| 44 | // Local Variables: //
 | 
|---|
| 45 | // tab-width: 4 //
 | 
|---|
| 46 | // compile-command: "cfa vector_test.c vector_int.o array.o" //
 | 
|---|
| 47 | // End: //
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.