Changeset a73d57a for src/examples
- Timestamp:
- Feb 17, 2016, 3:08:28 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:
- 30aeb27
- Parents:
- 9407ed8 (diff), 658f6de0 (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
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/abs.c
r9407ed8 ra73d57a 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 3 11:14:58201613 // Update Count : 4 312 // Last Modified On : Wed Feb 17 09:32:04 2016 13 // Update Count : 44 14 14 // 15 15 … … 18 18 19 19 int main( void ) { 20 ofstream *sout = ofstream_stdout();21 22 20 char ch = -65; 23 21 sout | "char\t\t\t" | ch | "\tabs " | abs( ch ) | endl; -
src/examples/alloc.c
r9407ed8 ra73d57a 11 11 // Created On : Wed Feb 3 07:56:22 2016 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Wed Feb 3 16:32:04201614 // Update Count : 3813 // Last Modified On : Wed Feb 17 11:43:23 2016 14 // Update Count : 40 15 15 // 16 16 … … 27 27 28 28 int main( void ) { 29 ofstream * sout = ofstream_stdout();30 31 29 size_t size = 10; 32 30 int * p; … … 100 98 free( x ); 101 99 #endif 102 free( sout );103 100 } 104 101 -
src/examples/fstream_test.c
r9407ed8 ra73d57a 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:11:33 201613 // Update Count : 4 212 // Last Modified On : Wed Feb 17 11:45:43 2016 13 // Update Count : 43 14 14 // 15 15 … … 17 17 18 18 int main( void ) { 19 ofstream *sout = ofstream_stdout();20 ifstream *sin = ifstream_stdin();21 19 int nombre; 22 20 sout | "Entrez un nombre, s'il vous plaît:\n"; -
src/examples/hello.c
r9407ed8 ra73d57a 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:11:49201613 // Update Count : 712 // Last Modified On : Wed Feb 17 12:11:45 2016 13 // Update Count : 8 14 14 // 15 15 … … 17 17 18 18 int main() { 19 ofstream *sout = ofstream_stdout();20 ifstream *sin = ifstream_stdin();21 19 sout | "Bonjour au monde!\n"; 22 20 } -
src/examples/identity.c
r9407ed8 ra73d57a 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:11:58201613 // Update Count : 812 // Last Modified On : Wed Feb 17 12:17:32 2016 13 // Update Count : 10 14 14 // 15 15 … … 22 22 23 23 int main() { 24 ofstream *sout = ofstream_stdout();25 24 sout | "char\t\t\t" | identity( 'z' ) | endl; 26 25 sout | "signed int\t\t" | identity( 4 ) | endl; … … 30 29 sout | "signed long long int\t" | identity( 4ll ) | endl; 31 30 sout | "unsigned long long int\t" | identity( 4ull ) | endl; 32 sout | "float\t\t\t" | identity( 4. 0f ) | endl;33 sout | "double\t\t\t" | identity( 4. 0) | endl;34 sout | "long double\t\t" | identity( 4. 0l ) | endl;31 sout | "float\t\t\t" | identity( 4.1f ) | endl; 32 sout | "double\t\t\t" | identity( 4.1 ) | endl; 33 sout | "long double\t\t" | identity( 4.1l ) | endl; 35 34 } 36 35 -
src/examples/minmax.c
r9407ed8 ra73d57a 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 3 11:14:49201613 // Update Count : 4 612 // Last Modified On : Wed Feb 17 12:17:53 2016 13 // Update Count : 47 14 14 // 15 15 … … 18 18 19 19 int main( void ) { 20 ofstream *sout = ofstream_stdout();21 20 // char does not have less or greater than. 22 21 int ?<?( char op1, char op2 ) { return (int)op1 < (int)op2; } -
src/examples/quad.c
r9407ed8 ra73d57a 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:13:48201613 // Update Count : 512 // Last Modified On : Wed Feb 17 12:19:24 2016 13 // Update Count : 6 14 14 // 15 15 … … 27 27 28 28 int main() { 29 ofstream *sout = ofstream_stdout();30 29 int N = 2; 31 30 sout | "result of quad of " | N | " is " | quad( N ) | endl; -
src/examples/quoted_keyword.c
r9407ed8 ra73d57a 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:13:58201613 // Update Count : 812 // Last Modified On : Wed Feb 17 12:19:45 2016 13 // Update Count : 9 14 14 // 15 15 … … 28 28 29 29 int main() { 30 ofstream *sout = ofstream_stdout();31 30 sout | `catch` + st.`type` + st.`struct` + `throw` | endl; 32 31 } -
src/examples/random.c
r9407ed8 ra73d57a 7 7 8 8 int main() { 9 ofstream *sout = ofstream_stdout();10 11 9 randseed( getpid() ); // set random seed 12 10 -
src/examples/square.c
r9407ed8 ra73d57a 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:14:16201613 // Update Count : 2 512 // Last Modified On : Wed Feb 17 12:21:58 2016 13 // Update Count : 26 14 14 // 15 15 … … 23 23 int main() { 24 24 #if 0 25 ofstream *sout = ofstream_stdout();26 25 sout | "result of squaring 9 is " | endl; 27 26 -
src/examples/sum.c
r9407ed8 ra73d57a 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Feb 6 11:57:42201613 // Update Count : 18 212 // Last Modified On : Tue Feb 16 23:49:31 2016 13 // Update Count : 189 14 14 // 15 15 … … 41 41 int main( void ) { 42 42 const int low = 5, High = 15, size = High - low; 43 ofstream *sout = ofstream_stdout();44 43 45 44 char s = 0, a[size], v = low; -
src/examples/swap.c
r9407ed8 ra73d57a 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 3 11:14:04201613 // Update Count : 6 312 // Last Modified On : Wed Feb 17 12:22:12 2016 13 // Update Count : 64 14 14 // 15 15 … … 18 18 19 19 int main( void ) { 20 ofstream *sout = ofstream_stdout();21 22 20 char c1 = 'a', c2 = 'b'; 23 21 sout | "char\t\t\t" | c1 | ' ' | c2 | "\t\t\tswap "; -
src/examples/twice.c
r9407ed8 ra73d57a 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:14:44201613 // Update Count : 1 212 // Last Modified On : Wed Feb 17 12:23:25 2016 13 // Update Count : 13 14 14 // 15 15 … … 27 27 char ?++( char *op ) { char temp = *op; *op += 1; return temp; } 28 28 29 ofstream *sout = ofstream_stdout();30 29 sout | twice( 'a' ) | ' ' | twice( 1 ) | ' ' | twice( 3.2 ) | endl; 31 30 } -
src/examples/vector_test.c
r9407ed8 ra73d57a 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:14:52201613 // Update Count : 1 712 // Last Modified On : Wed Feb 17 12:23:55 2016 13 // Update Count : 18 14 14 // 15 15 … … 20 20 21 21 int main( void ) { 22 ofstream *sout = ofstream_stdout();23 ifstream *sin = ifstream_stdin();24 22 vector_int vec = vector_int_allocate(); 25 23
Note:
See TracChangeset
for help on using the changeset viewer.