Changeset 90c3b1c for src/examples/sum.c


Ignore:
Timestamp:
Mar 2, 2016, 4:59:19 PM (8 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:
bdad1679
Parents:
ac1ed49
Message:

compile CFA with C++11, further update refrat with lstlisting macros, support varags, enumeration initialization, add implicit separators to output streams, update example programs that print

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/sum.c

    rac1ed49 r90c3b1c  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb 16 23:49:31 2016
    13 // Update Count     : 189
     12// Last Modified On : Wed Mar  2 14:31:45 2016
     13// Update Count     : 193
    1414//
    1515
     
    4747                a[i] = v;
    4848        } // for
    49         sout | "sum from " | low | " to " | High | " is "
    50                  | (int)sum( size, a ) | ", check " | (int)s | endl;
     49        sout | "sum from" | low | "to" | High | "is"
     50                 | (int)sum( size, a ) | "" | ", check" | (int)s | endl;
    5151
    5252        int s = 0, a[size], v = low;
     
    5555                a[i] = (int)v;
    5656        } // for
    57         sout | "sum from " | low | " to " | High | " is "
    58                  | sum( size, (int *)a ) | ", check " | (int)s | endl;
     57        sout | "sum from" | low | "to" | High | "is"
     58                 | sum( size, (int *)a ) | "" | ", check" | (int)s | endl;
    5959
    6060        float s = 0.0, a[size], v = low / 10.0;
     
    6363                a[i] = (float)v;
    6464        } // for
    65         sout | "sum from " | low / 10.0 | " to " | High / 10.0 | " is "
    66                  | sum( size, (float *)a ) | ", check " | (float)s | endl;
     65        sout | "sum from" | low / 10.0 | "to" | High / 10.0 | "is"
     66                 | sum( size, (float *)a ) | "" | ", check" | (float)s | endl;
    6767
    6868        double s = 0, a[size], v = low / 10.0;
     
    7171                a[i] = (double)v;
    7272        } // for
    73         sout | "sum from " | low / 10.0 | " to " | High / 10.0 | " is "
    74                  | sum( size, (double *)a ) | ", check " | (double)s | endl;
     73        sout | "sum from" | low / 10.0 | "to" | High / 10.0 | "is"
     74                 | sum( size, (double *)a ) | "" | ", check" | (double)s | endl;
    7575
    7676        struct S { int i, j; } 0 = { 0, 0 }, 1 = { 1, 1 };
     
    7979        S ++?( S *t ) { *t += 1; return *t; }
    8080        S ?++( S *t ) { S temp = *t; *t += 1; return temp; }
    81         ofstream * ?|?( ofstream * os, S v ) { return os | v.i | ' ' | v.j; }
     81        ofstream * ?|?( ofstream * os, S v ) { return os | v.i | v.j; }
    8282
    8383        S s = 0, a[size], v = { low, low };
     
    8686                a[i] = (S)v;
    8787        } // for
    88         sout | "sum from " | low | " to " | High | " is "
    89                  | sum( size, (S *)a ) | ", check " | (S)s | endl;
     88        sout | "sum from" | low | "to" | High | "is"
     89                 | sum( size, (S *)a ) | "" | ", check" | (S)s | endl;
    9090} // main
    9191
Note: See TracChangeset for help on using the changeset viewer.