ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        ctor
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        gc_noraii
        jacob/cs343-translation
        jenkins-sandbox
        memory
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        resolv-new
        string
        with_gc
      
      
        
          | Last change
 on this file since 6ed1d4b was             bd85400, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago | 
        
          | 
remove offsetof keyword, parser 0/1 names as structure fields, update examples to new stdlib, rename algorithms to stdlib, extend stdlib, use correct type for box parameters
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            879 bytes | 
      
      
| Rev | Line |  | 
|---|
| [5721a6d] | 1 | extern "C" { | 
|---|
|  | 2 | #include <unistd.h>                                                                             // getpid | 
|---|
|  | 3 | } // extern "C" | 
|---|
|  | 4 |  | 
|---|
|  | 5 | #include <fstream> | 
|---|
| [bd85400] | 6 | #include <stdlib>                                                                               // random | 
|---|
| [5721a6d] | 7 |  | 
|---|
|  | 8 | int main() { | 
|---|
|  | 9 | ofstream *sout = ofstream_stdout(); | 
|---|
|  | 10 |  | 
|---|
|  | 11 | randseed( getpid() );                                                           // set random seed | 
|---|
|  | 12 |  | 
|---|
|  | 13 | // test polymorphic calls to random and stream | 
|---|
|  | 14 | char c = random(); | 
|---|
|  | 15 | sout | c | endl; | 
|---|
|  | 16 | int i = random(); | 
|---|
|  | 17 | sout | i | endl; | 
|---|
|  | 18 | unsigned int ui = random(); | 
|---|
|  | 19 | sout | ui | endl; | 
|---|
|  | 20 | long int li = random(); | 
|---|
|  | 21 | sout | li | endl; | 
|---|
|  | 22 | unsigned long int uli = random(); | 
|---|
|  | 23 | sout | uli | endl; | 
|---|
|  | 24 | float f = random(); | 
|---|
|  | 25 | sout | f | endl; | 
|---|
|  | 26 | double d = random(); | 
|---|
|  | 27 | sout | d | endl; | 
|---|
|  | 28 | float _Complex fc = random(); | 
|---|
|  | 29 | sout | fc | endl; | 
|---|
|  | 30 | double _Complex dc = random(); | 
|---|
|  | 31 | sout | dc | endl; | 
|---|
|  | 32 | long double _Complex ldc = random(); | 
|---|
|  | 33 | sout | ldc | endl; | 
|---|
|  | 34 | } // main | 
|---|
|  | 35 |  | 
|---|
|  | 36 | // Local Variables: // | 
|---|
|  | 37 | // tab-width: 4 // | 
|---|
|  | 38 | // compile-command: "cfa random.c" // | 
|---|
|  | 39 | // End: // | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.