Changeset 36ebd03 for src/examples
- Timestamp:
- Mar 3, 2016, 1:28:56 PM (10 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:
- 3627356
- Parents:
- 9d7b3ea (diff), 4040425 (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. - Location:
- src/examples
- Files:
-
- 2 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/Makefile.in
r9d7b3ea r36ebd03 189 189 esac; \ 190 190 done; \ 191 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/examples/Makefile'; \191 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/examples/Makefile'; \ 192 192 $(am__cd) $(top_srcdir) && \ 193 $(AUTOMAKE) -- gnusrc/examples/Makefile193 $(AUTOMAKE) --foreign src/examples/Makefile 194 194 .PRECIOUS: Makefile 195 195 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
src/examples/abs.c
r9d7b3ea r36ebd03 10 10 // Created On : Thu Jan 28 18:26:16 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 17 09:32:04201613 // Update Count : 4412 // Last Modified On : Wed Mar 2 15:07:26 2016 13 // Update Count : 51 14 14 // 15 15 … … 20 20 char ch = -65; 21 21 sout | "char\t\t\t" | ch | "\tabs " | abs( ch ) | endl; 22 sout | "signed int\t\t" | -65 | "\tabs 23 sout | "signed long int\t\t" | -65l | "\tabs 24 sout | "signed long long int\t" | -65ll | "\tabs 25 sout | "float\t\t\t" | -65.0f | "\tabs 26 sout | "double\t\t\t" | -65.0 | "\tabs 27 sout | "long double\t\t" | -65.0l | "\tabs 28 sout | "float _Complex\t\t" | -65.0F-2.0iF | "\tabs 29 sout | "double _Complex\t\t" | -65.0D-2.0iD | "\tabs 30 sout | "long double _Complex\t" | -65.0L-2.0iL | "\tabs 22 sout | "signed int\t\t" | -65 | "\tabs" | abs( -65 ) | endl; 23 sout | "signed long int\t\t" | -65l | "\tabs" | abs( -65l ) | endl; 24 sout | "signed long long int\t" | -65ll | "\tabs" | abs( -65ll ) | endl; 25 sout | "float\t\t\t" | -65.0f | "\tabs" | abs( -65.0f ) | endl; 26 sout | "double\t\t\t" | -65.0 | "\tabs" | abs( -65.0 ) | endl; 27 sout | "long double\t\t" | -65.0l | "\tabs" | abs( -65.0l ) | endl; 28 sout | "float _Complex\t\t" | -65.0F-2.0iF | "\tabs" | abs( -65.0F-2.0iF ) | endl; 29 sout | "double _Complex\t\t" | -65.0D-2.0iD | "\tabs" | abs( -65.0D-2.0iD ) | endl; 30 sout | "long double _Complex\t" | -65.0L-2.0iL | "\tabs" | abs( -65.0L-2.0iL ) | endl; 31 31 } // main 32 32 -
src/examples/array.c
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Ma y 27 18:10:13 201513 // Update Count : 212 // Last Modified On : Wed Mar 2 18:13:52 2016 13 // Update Count : 3 14 14 // 15 15 16 16 #include "array.h" 17 17 18 /// forall( type array_type, elt_type | bounded_array( array_type, elt_type ) )18 /// forall( otype array_type, elt_type | bounded_array( array_type, elt_type ) ) 19 19 /// [ array_iterator begin, array_iterator end ] 20 20 /// get_iterators( array_type array ) … … 25 25 26 26 // The first element is always at index 0. 27 forall( type array_type,type elt_type | bounded_array( array_type, elt_type ) )27 forall( otype array_type, otype elt_type | bounded_array( array_type, elt_type ) ) 28 28 elt_type * begin( array_type array ) { 29 29 return &array[ 0 ]; … … 31 31 32 32 // The end iterator should point one past the last element. 33 forall( type array_type,type elt_type | bounded_array( array_type, elt_type ) )33 forall( otype array_type, otype elt_type | bounded_array( array_type, elt_type ) ) 34 34 elt_type * end( array_type array ) { 35 35 return &array[ last( array ) ] + 1; -
src/examples/array.h
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jan 26 17:09:29201613 // Update Count : 312 // Last Modified On : Wed Mar 2 18:13:35 2016 13 // Update Count : 5 14 14 // 15 15 … … 21 21 // An array has contiguous elements accessible in any order using integer indicies. The first 22 22 // element has index 0. 23 context array( type array_type,type elt_type ) {23 trait array( otype array_type, otype elt_type ) { 24 24 lvalue elt_type ?[?]( array_type, int ); 25 25 }; 26 26 27 27 // A bounded array is an array that carries its maximum index with it. 28 context bounded_array( type array_type,type elt_type | array( array_type, elt_type ) ) {28 trait bounded_array( otype array_type, otype elt_type | array( array_type, elt_type ) ) { 29 29 int last( array_type ); 30 30 }; … … 34 34 typedef int array_iterator; 35 35 36 /// forall( type array_type, elt_type | bounded_array( array_type, elt_type ) )36 /// forall( otype array_type, elt_type | bounded_array( array_type, elt_type ) ) 37 37 /// [ array_iterator begin, array_iterator end ] get_iterators( array_type ); 38 38 … … 40 40 // A bounded array can be iterated over by using a pointer to the element type. These functions 41 41 // return iterators corresponding to the first element and the one-past-the-end element, STL-style. 42 forall( type array_type,type elt_type | bounded_array( array_type, elt_type ) )42 forall( otype array_type, otype elt_type | bounded_array( array_type, elt_type ) ) 43 43 elt_type *begin( array_type ); 44 44 45 forall( type array_type,type elt_type | bounded_array( array_type, elt_type ) )45 forall( otype array_type, otype elt_type | bounded_array( array_type, elt_type ) ) 46 46 elt_type *end( array_type ); 47 47 -
src/examples/ato.c
r9d7b3ea r36ebd03 11 11 // Created On : Thu Feb 4 08:10:57 2016 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Wed Feb 17 11:44:03201614 // Update Count : 4 213 // Last Modified On : Mon Feb 29 17:57:35 2016 14 // Update Count : 44 15 15 // 16 16 … … 24 24 int main( void ) { 25 25 int i = ato( "-123" ); 26 sout | i | ' ' |"-123" | endl;26 sout | i | "-123" | endl; 27 27 unsigned int ui = ato( "123" ); 28 sout | ui | ' ' |"123" | endl;28 sout | ui | "123" | endl; 29 29 long int li = ato( "-123" ); 30 sout | li | ' ' |"-123" | endl;30 sout | li | "-123" | endl; 31 31 unsigned long int uli = ato( "123" ); 32 sout | uli | ' ' |"123" | endl;32 sout | uli | "123" | endl; 33 33 long long int lli = ato( "-123" ); 34 sout | lli | ' ' |"-123" | endl;34 sout | lli | "-123" | endl; 35 35 unsigned long long int ulli = ato( "123" ); 36 sout | ulli | ' ' |"123" | endl;36 sout | ulli | "123" | endl; 37 37 float f = ato( "-123.456" ); 38 sout | f | ' ' |"-123.456" | endl;38 sout | f | "-123.456" | endl; 39 39 double d = ato( "-123.4567890123456" ); 40 sout | d | ' ' |"-123.4567890123456" | endl;40 sout | d | "-123.4567890123456" | endl; 41 41 long double ld = ato( "-123.45678901234567890123456789" ); 42 sout | ld | ' ' |"-123.45678901234567890123456789" | endl;42 sout | ld | "-123.45678901234567890123456789" | endl; 43 43 float _Complex fc = ato( "-123.456-123.456i" ); 44 sout | fc | ' ' |"-123.456-123.456i" | endl;44 sout | fc | "-123.456-123.456i" | endl; 45 45 double _Complex dc = ato( "-123.4567890123456+123.4567890123456i" ); 46 sout | dc | ' ' |"-123.4567890123456+123.4567890123456i" | endl;46 sout | dc | "-123.4567890123456+123.4567890123456i" | endl; 47 47 long double _Complex ldc = ato( "123.45678901234567890123456789-123.45678901234567890123456789i" ); 48 sout | ldc | ' ' |"123.45678901234567890123456789-123.45678901234567890123456789i" | endl;48 sout | ldc | "123.45678901234567890123456789-123.45678901234567890123456789i" | endl; 49 49 long double _Complex ldc2 = ato( "123.45678901234-123.4567890i" ); 50 sout | ldc2 | ' ' | "123.45678901234567890123456789-123.45678901234567890123456789i" | endl;50 sout | ldc2 | "123.45678901234-123.4567890i" | endl; 51 51 } // main 52 52 -
src/examples/ctxts.c
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Ma y 27 18:11:19 201513 // Update Count : 212 // Last Modified On : Wed Mar 2 18:10:21 2016 13 // Update Count : 3 14 14 // 15 15 16 context has_f( type T ) {16 trait has_f( type T ) { 17 17 T f( T ); 18 18 }; 19 19 20 context has_g( type U | has_f( U ) ) {20 trait has_g( type U | has_f( U ) ) { 21 21 U g( U ); 22 22 }; -
src/examples/fstream_test.c
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 17 11:45:43201613 // Update Count : 4312 // Last Modified On : Wed Mar 2 15:12:21 2016 13 // Update Count : 51 14 14 // 15 15 … … 18 18 int main( void ) { 19 19 int nombre; 20 sout | "Entrez un nombre, s'il vous plaît: \n";20 sout | "Entrez un nombre, s'il vous plaît:" | endl; 21 21 sin | &nombre; 22 sout | "Vous avez entré " | nombre | " stocké à l'adresse " | &nombre | endl; 23 sout | "nombre " | nombre | " est " 24 | (nombre > 0 ? "plus grand que" : 25 nombre == 0 ? "égal à" : "moins de") 26 | " zéro" | endl; 22 sout | "Vous avez entré" | nombre | "stocké à l'adresse" | &nombre | endl; 23 sout | "nombre" | nombre | "est" 24 | (nombre > 0 ? "plus grand que" : nombre == 0 ? "égal à" : "moins de") 25 | "zéro" | endl; 27 26 28 sout | "Entrez trois nombres, s'il vous plaît: \n";27 sout | "Entrez trois nombres, s'il vous plaît: " | endl; 29 28 int i, j, k; 30 29 sin | &i | &j | &k; 31 sout | "Vous avez entré " | "i:" | i | " j:" | j | " k:" | k | endl; 32 33 sout | 3 | ' ' | 3.5 | ' ' | 'a' | ' ' | "abc" | endl; 30 sout | "Vous avez entré" | "i:" | i | "j:" | j | "k:" | k | endl; 34 31 } 35 32 -
src/examples/hello.c
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 17 12:11:45201613 // Update Count : 812 // Last Modified On : Mon Feb 29 18:06:17 2016 13 // Update Count : 10 14 14 // 15 15 … … 17 17 18 18 int main() { 19 sout | "Bonjour au monde! \n";19 sout | "Bonjour au monde!" | endl; 20 20 } 21 21 -
src/examples/identity.c
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 17 12:17:32201613 // Update Count : 1 012 // Last Modified On : Mon Feb 29 23:40:45 2016 13 // Update Count : 12 14 14 // 15 15 -
src/examples/index.h
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Ma y 27 18:17:31 201513 // Update Count : 112 // Last Modified On : Wed Mar 2 18:10:46 2016 13 // Update Count : 2 14 14 // 15 15 16 context index( type T ) {16 trait index( type T ) { 17 17 T ?+?( T, T ); 18 18 T ?-?( T, T ); -
src/examples/it_out.c
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Ma y 27 18:41:23 201513 // Update Count : 412 // Last Modified On : Wed Mar 2 18:11:00 2016 13 // Update Count : 5 14 14 // 15 15 16 16 typedef unsigned long streamsize_type; 17 17 18 context ostream( dtype os_type ) {18 trait ostream( dtype os_type ) { 19 19 os_type *write( os_type *, const char *, streamsize_type ); 20 20 int fail( os_type * ); 21 21 }; 22 22 23 context writeable( type T ) {23 trait writeable( type T ) { 24 24 forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, T ); 25 25 }; … … 29 29 forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, const char * ); 30 30 31 context istream( dtype is_type ) {31 trait istream( dtype is_type ) { 32 32 is_type *read( is_type *, char *, streamsize_type ); 33 33 is_type *unread( is_type *, char ); … … 36 36 }; 37 37 38 context readable( type T ) {38 trait readable( type T ) { 39 39 forall( dtype is_type | istream( is_type ) ) is_type * ?<<?( is_type *, T ); 40 40 }; … … 43 43 forall( dtype is_type | istream( is_type ) ) is_type * ?>>?( is_type *, int* ); 44 44 45 context iterator( type iterator_type, type elt_type ) {45 trait iterator( type iterator_type, type elt_type ) { 46 46 iterator_type ?++( iterator_type* ); 47 47 iterator_type ++?( iterator_type* ); -
src/examples/minmax.c
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 17 12:17:53201613 // Update Count : 4 712 // Last Modified On : Mon Feb 29 23:45:16 2016 13 // Update Count : 49 14 14 // 15 15 … … 23 23 24 24 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmin " | min( 'z', 'a' ) | endl; 25 sout | "signed int\t\t" | 4 | ' ' | 3 | "\tmin" | min( 4, 3 ) | endl;26 sout | "unsigned int\t\t" | 4u | ' ' | 3u | "\tmin" | min( 4u, 3u ) | endl;27 sout | "signed long int\t\t" | 4l | ' ' | 3l | "\tmin" | min( 4l, 3l ) | endl;28 sout | "unsigned long int\t" | 4ul | ' ' | 3ul | "\tmin" | min( 4ul, 3ul ) | endl;29 sout | "signed long long int\t" | 4ll | ' ' | 3ll | "\tmin" | min( 4ll, 3ll ) | endl;30 sout | "unsigned long long int\t" | 4ull | ' ' | 3ull | "\tmin" | min( 4ull, 3ull ) | endl;31 sout | "float\t\t\t" | 4.0f | ' ' | 3.1f | "\tmin" | min( 4.0f, 3.1f ) | endl;32 sout | "double\t\t\t" | 4.0 | ' ' | 3.1 | "\tmin" | min( 4.0, 3.1 ) | endl;33 sout | "long double\t\t" | 4.0l | ' ' | 3.1l | "\tmin" | min( 4.0l, 3.1l ) | endl;25 sout | "signed int\t\t" | 4 | 3 | "\tmin" | min( 4, 3 ) | endl; 26 sout | "unsigned int\t\t" | 4u | 3u | "\tmin" | min( 4u, 3u ) | endl; 27 sout | "signed long int\t\t" | 4l | 3l | "\tmin" | min( 4l, 3l ) | endl; 28 sout | "unsigned long int\t" | 4ul | 3ul | "\tmin" | min( 4ul, 3ul ) | endl; 29 sout | "signed long long int\t" | 4ll | 3ll | "\tmin" | min( 4ll, 3ll ) | endl; 30 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmin" | min( 4ull, 3ull ) | endl; 31 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmin" | min( 4.0f, 3.1f ) | endl; 32 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmin" | min( 4.0, 3.1 ) | endl; 33 sout | "long double\t\t" | 4.0l | 3.1l | "\tmin" | min( 4.0l, 3.1l ) | endl; 34 34 35 35 sout | endl; 36 36 37 37 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmax " | max( 'z', 'a' ) | endl; 38 sout | "signed int\t\t" | 4 | ' ' | 3 | "\tmax" | max( 4, 3 ) | endl;39 sout | "unsigned int\t\t" | 4u | ' ' | 3u | "\tmax" | max( 4u, 3u ) | endl;40 sout | "signed long int\t\t" | 4l | ' ' | 3l | "\tmax" | max( 4l, 3l ) | endl;41 sout | "unsigned long int\t" | 4ul | ' ' | 3ul | "\tmax" | max( 4ul, 3ul ) | endl;42 sout | "signed long long int\t" | 4ll | ' ' | 3ll | "\tmax" | max( 4ll, 3ll ) | endl;43 sout | "unsigned long long int\t" | 4ull | ' ' | 3ull | "\tmax" | max( 4ull, 3ull ) | endl;44 sout | "float\t\t\t" | 4.0f | ' ' | 3.1f | "\tmax" | max( 4.0f, 3.1f ) | endl;45 sout | "double\t\t\t" | 4.0 | ' ' | 3.1 | "\tmax" | max( 4.0, 3.1 ) | endl;46 sout | "long double\t\t" | 4.0l | ' ' | 3.1l | "\tmax" | max( 4.0l, 3.1l ) | endl;38 sout | "signed int\t\t" | 4 | 3 | "\tmax" | max( 4, 3 ) | endl; 39 sout | "unsigned int\t\t" | 4u | 3u | "\tmax" | max( 4u, 3u ) | endl; 40 sout | "signed long int\t\t" | 4l | 3l | "\tmax" | max( 4l, 3l ) | endl; 41 sout | "unsigned long int\t" | 4ul | 3ul | "\tmax" | max( 4ul, 3ul ) | endl; 42 sout | "signed long long int\t" | 4ll | 3ll | "\tmax" | max( 4ll, 3ll ) | endl; 43 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmax" | max( 4ull, 3ull ) | endl; 44 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmax" | max( 4.0f, 3.1f ) | endl; 45 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmax" | max( 4.0, 3.1 ) | endl; 46 sout | "long double\t\t" | 4.0l | 3.1l | "\tmax" | max( 4.0l, 3.1l ) | endl; 47 47 } // main 48 48 -
src/examples/prolog.c
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Ma y 27 18:25:52 201513 // Update Count : 112 // Last Modified On : Wed Mar 2 18:11:18 2016 13 // Update Count : 2 14 14 // 15 15 … … 25 25 void is_integer( int x ) {} 26 26 27 context ArithmeticType( type T ) {27 trait ArithmeticType( type T ) { 28 28 void is_arithmetic( T ); 29 29 }; 30 30 31 context IntegralType( type T | ArithmeticType( T ) ) {31 trait IntegralType( type T | ArithmeticType( T ) ) { 32 32 void is_integer( T ); 33 33 }; -
src/examples/quad.c
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 17 12:19:24201613 // Update Count : 612 // Last Modified On : Tue Mar 1 08:24:56 2016 13 // Update Count : 7 14 14 // 15 15 … … 28 28 int main() { 29 29 int N = 2; 30 sout | "result of quad of " | N | " is" | quad( N ) | endl;30 sout | "result of quad of" | N | "is" | quad( N ) | endl; 31 31 } 32 32 -
src/examples/sum.c
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 16 23:49:31 201613 // Update Count : 1 8912 // Last Modified On : Wed Mar 2 18:12:01 2016 13 // Update Count : 194 14 14 // 15 15 16 16 #include <fstream> 17 17 18 context sumable( type T ) {18 trait sumable( type T ) { 19 19 const T 0; 20 20 T ?+?( T, T ); … … 47 47 a[i] = v; 48 48 } // 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; 51 51 52 52 int s = 0, a[size], v = low; … … 55 55 a[i] = (int)v; 56 56 } // 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; 59 59 60 60 float s = 0.0, a[size], v = low / 10.0; … … 63 63 a[i] = (float)v; 64 64 } // 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; 67 67 68 68 double s = 0, a[size], v = low / 10.0; … … 71 71 a[i] = (double)v; 72 72 } // 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; 75 75 76 76 struct S { int i, j; } 0 = { 0, 0 }, 1 = { 1, 1 }; … … 79 79 S ++?( S *t ) { *t += 1; return *t; } 80 80 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; } 82 82 83 83 S s = 0, a[size], v = { low, low }; … … 86 86 a[i] = (S)v; 87 87 } // 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; 90 90 } // main 91 91 -
src/examples/swap.c
r9d7b3ea r36ebd03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 17 12:22:12201613 // Update Count : 6 412 // Last Modified On : Wed Mar 2 16:15:11 2016 13 // Update Count : 65 14 14 // 15 15 … … 54 54 55 55 float f1 = 1.5, f2 = 2.5; 56 sout | "float\t\t\t" | f1 | ' ' | f2 | "\t\t \tswap ";56 sout | "float\t\t\t" | f1 | ' ' | f2 | "\t\tswap "; 57 57 swap( &f1, &f2 ); 58 58 sout | '\t' | f1 | ' ' | f2 | endl; 59 59 60 60 double d1 = 1.5, d2 = 2.5; 61 sout | "double\t\t\t" | d1 | ' ' | d2 | "\t\t \tswap ";61 sout | "double\t\t\t" | d1 | ' ' | d2 | "\t\tswap "; 62 62 swap( &d1, &d2 ); 63 63 sout | '\t' | d1 | ' ' | d2 | endl; 64 64 65 65 long double ld1 = 1.5, ld2 = 2.5; 66 sout | "long double\t\t" | ld1 | ' ' | ld2 | "\t\t \tswap ";66 sout | "long double\t\t" | ld1 | ' ' | ld2 | "\t\tswap "; 67 67 swap( &ld1, &ld2 ); 68 68 sout | '\t' | ld1 | ' ' | ld2 | endl; -
src/examples/tests/vector_test.out.txt
r9d7b3ea r36ebd03 1 1 enter N elements and C-d on a separate line: 2 2 Array elements: 3 1 2 3 4 5 3 1 2 3 4 5 4 4 Array elements reversed: 5 5 4 3 2 1 5 5 4 3 2 1
Note:
See TracChangeset
for help on using the changeset viewer.