Ignore:
Timestamp:
May 27, 2015, 8:33:19 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
00cc023
Parents:
52ac3b4
Message:

licencing: eighth groups of files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/vector_test.c

    r52ac3b4 r86bd7c1f  
     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 : Wed May 27 18:42:55 2015
     13// Update Count     : 2
     14//
     15
    116#include "fstream.h"
    217#include "vector_int.h"
     
    520
    621int main() {
    7     ofstream *sout = ofstream_stdout();
    8     ifstream *sin = ifstream_stdin();
    9     vector_int vec = vector_int_allocate();
     22        ofstream *sout = ofstream_stdout();
     23        ifstream *sin = ifstream_stdin();
     24        vector_int vec = vector_int_allocate();
    1025
    11     // read in numbers until EOF or error
    12     int num;
     26        // read in numbers until EOF or error
     27        int num;
    1328
    14     sout << "enter N elements and C-d on a separate line:\n";
    15     for ( ;; ) {
     29        sout << "enter N elements and C-d on a separate line:\n";
     30        for ( ;; ) {
    1631        sin >> &num;
    17       if ( fail( sin ) || eof( sin ) ) break;
     32          if ( fail( sin ) || eof( sin ) ) break;
    1833        append( &vec, num );
    19     }
    20     // write out the numbers
     34        }
     35        // write out the numbers
    2136
    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 ) {
     37        sout << "Array elements:\n";
     38//      write_all( begin( vec ), end( vec ), sout );
     39//      sout << "\n";
     40        for ( int index = 0; index <= last( vec ); index += 1 ) {
    2641        sout << vec[ index ] << " ";
    27     }
    28     sout << "\n";
     42        }
     43        sout << "\n";
    2944#if 1
    30     sout << "Array elements reversed:\n";
    31     write_reverse( begin( vec ), end( vec ), sout );
    32     sout << "\n";
     45        sout << "Array elements reversed:\n";
     46        write_reverse( begin( vec ), end( vec ), sout );
     47        sout << "\n";
    3348#endif
    3449}
    3550
    3651// ../bin/cfa vector_test.c fstream.o iostream.o vector_int.o iterator.o array.o
     52
     53// Local Variables: //
     54// tab-width: 4 //
     55// compile-command: "cfa vector_test.c fstream.o iostream.o vector_int.o iterator.o array.o" //
     56// End: //
Note: See TracChangeset for help on using the changeset viewer.