Changeset 784deab for src/examples/sum.c


Ignore:
Timestamp:
Jan 8, 2016, 10:37:10 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:
61f9356
Parents:
1cced28
Message:

fix recursive include bug in shadow includes, major clean of examples, add several long long routines to prelude

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/sum.c

    r1cced28 r784deab  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Nov 21 18:08:18 2015
    13 // Update Count     : 119
     12// Last Modified On : Mon Jan  4 07:40:24 2016
     13// Update Count     : 126
    1414//
    1515
    16 extern "C" {
    17         int printf( char *, ... );
    18 }
    1916#include "fstream.h"
    2017
     
    4138char ?++( char *op ) { char temp = *op; *op += 1; return temp; }
    4239
    43 int main() {
     40int main( void ) {
    4441        const int low = 5, High = 15, size = High - low;
    4542
     
    5249                a[i] = v;
    5350        }
    54         sout << "sum from " << low << " to " << High << " is "
    55                  << (int)sum( size, a ) << ", check " << (int)s << endl;
     51        sout | "sum from " | low | " to " | High | " is "
     52                 | (int)sum( size, a ) | ", check " | (int)s | endl;
    5653
    5754        int s = 0, a[size];
     
    6158                a[i] = (int)v;
    6259        }
    63         sout << "sum from " << low << " to " << High << " is "
    64                  << sum( size, (int *)a ) << ", check " << (int)s << endl;
     60        sout | "sum from " | low | " to " | High | " is "
     61                 | sum( size, (int *)a ) | ", check " | (int)s | endl;
    6562
    6663        double s = 0.0, a[size];
     
    7067                a[i] = (double)v;
    7168        }
    72         printf( "%g\n", sum( size, (double *)a ) );
    73 //      sout << "sum from " << low / 10.0 << " to " << High / 10.0 << " is "
    74 //               << sum( size, (double *)a ) << ", check " << (double)s << endl;
     69        sout | "sum from " | low / 10.0 | " to " | High / 10.0 | " is "
     70                 | sum( size, (double *)a ) | ", check " | (double)s | endl;
    7571
    7672        float s = 0.0, a[size];
     
    8076                a[i] = (float)v;
    8177        }
    82         printf( "%g\n", sum( size, (float *)a ) );
    83 //      sout << "sum from " << low / 10.0 << " to " << High / 10.0 << " is "
    84 //               << sum( size, (float *)a ) << ", check " << (float)s << endl;
     78        sout | "sum from " | low / 10.0 | " to " | High / 10.0 | " is "
     79                 | sum( size, (float *)a ) | ", check " | (float)s | endl;
    8580}
    8681
    8782// Local Variables: //
    8883// tab-width: 4 //
    89 // compile-command: "cfa sum.c fstream.o iostream.o" //
     84// compile-command: "cfa sum.c fstream.o iostream.o iterator.o" //
    9085// End: //
Note: See TracChangeset for help on using the changeset viewer.