Changeset 36874e4 for src/examples/sum.c
- Timestamp:
- Jan 12, 2016, 3:36:20 PM (9 years ago)
- 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:
- ebe9b3a
- Parents:
- b18b0b5 (diff), 61f9356 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/sum.c
rb18b0b5 r36874e4 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Nov 21 18:08:18 201513 // Update Count : 1 1912 // Last Modified On : Mon Jan 4 07:40:24 2016 13 // Update Count : 126 14 14 // 15 15 16 extern "C" {17 int printf( char *, ... );18 }19 16 #include "fstream.h" 20 17 … … 41 38 char ?++( char *op ) { char temp = *op; *op += 1; return temp; } 42 39 43 int main( ) {40 int main( void ) { 44 41 const int low = 5, High = 15, size = High - low; 45 42 … … 52 49 a[i] = v; 53 50 } 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; 56 53 57 54 int s = 0, a[size]; … … 61 58 a[i] = (int)v; 62 59 } 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; 65 62 66 63 double s = 0.0, a[size]; … … 70 67 a[i] = (double)v; 71 68 } 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; 75 71 76 72 float s = 0.0, a[size]; … … 80 76 a[i] = (float)v; 81 77 } 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; 85 80 } 86 81 87 82 // Local Variables: // 88 83 // 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" // 90 85 // End: //
Note: See TracChangeset
for help on using the changeset viewer.