Changeset 94980502


Ignore:
Timestamp:
Mar 22, 2016, 10:19:00 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, string, with_gc
Children:
0438091
Parents:
984dce6
Message:

update examples

Location:
src/examples
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/examples/constants.c

    r984dce6 r94980502  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 25 23:44:12 2016
    13 // Update Count     : 76
     12// Last Modified On : Fri Mar 11 16:27:38 2016
     13// Update Count     : 81
    1414//
    1515
     
    4444        0x_ff_FF_ff_FF_ff_FF_ff_FF;
    4545        9_223_372_036_854_775_807;
    46         18_446_744_073_709_551_615;
     46        18_446_744_073_709_551_615UL;
    4747        3.141_59f;
    4848        3.14159;
     
    5353        L'\x_ff_ee';
    5454        L_"\x_ff_ee";
    55         L"a_b\r\Qyc\u_00_40  x_y_z\xff_AA";
    56         L_"a_b\r\Qyc\u_00_40\
     55        L"a_b\r\vyc\u_00_40  x_y_z\xff_AA";
     56        L_"a_b\r\vyc\u_00_40\
    5757  x_y_z\xff_AA";
    5858        "abc" "def" "ghi";
  • src/examples/limits.c

    r984dce6 r94980502  
    9898// Local Variables: //
    9999// tab-width: 4 //
    100 // compile-command: "cfa min.c" //
     100// compile-command: "cfa limits.c" //
    101101// End: //
  • src/examples/searchsort.c

    r984dce6 r94980502  
    1111// Created On       : Thu Feb  4 18:17:50 2016
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Wed Feb 17 12:21:04 2016
    14 // Update Count     : 46
     13// Last Modified On : Tue Mar 22 22:16:46 2016
     14// Update Count     : 55
    1515//
    1616
     
    3636                sout | *v | ", ";
    3737        } // for
     38        sout | endl | endl;
     39
     40        // descending sort/search by changing < to >
     41        for ( unsigned int i = 0; i < size; i += 1 ) {
     42                iarr[i] = i + 1;
     43                sout | iarr[i] | ", ";
     44        } // for
     45        sout | endl;
     46        {
     47                int ?<?( int x, int y ) { return x > y; }
     48                qsort( iarr, size );
     49                for ( unsigned int i = 0; i < size; i += 1 ) {
     50                        sout | iarr[i] | ", ";
     51                } // for
     52                sout | endl;
     53                for ( unsigned int i = 0; i < size; i += 1 ) {
     54                        int *v = bsearch( size - i, iarr, size );
     55                        sout | *v | ", ";
     56                } // for
     57        }
    3858        sout | endl | endl;
    3959
Note: See TracChangeset for help on using the changeset viewer.