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 6ce67ce was 6ba0659, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago |
major rewrite of I/O library and update example programs to use new I/O
|
-
Property mode
set to
100644
|
File size:
841 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 | randseed( getpid() ); // set random seed
|
---|
| 10 |
|
---|
| 11 | // test polymorphic calls to random and stream
|
---|
| 12 | char c = random();
|
---|
| 13 | sout | c | endl;
|
---|
| 14 | int i = random();
|
---|
| 15 | sout | i | endl;
|
---|
| 16 | unsigned int ui = random();
|
---|
| 17 | sout | ui | endl;
|
---|
| 18 | long int li = random();
|
---|
| 19 | sout | li | endl;
|
---|
| 20 | unsigned long int uli = random();
|
---|
| 21 | sout | uli | endl;
|
---|
| 22 | float f = random();
|
---|
| 23 | sout | f | endl;
|
---|
| 24 | double d = random();
|
---|
| 25 | sout | d | endl;
|
---|
| 26 | float _Complex fc = random();
|
---|
| 27 | sout | fc | endl;
|
---|
| 28 | double _Complex dc = random();
|
---|
| 29 | sout | dc | endl;
|
---|
| 30 | long double _Complex ldc = random();
|
---|
| 31 | sout | ldc | endl;
|
---|
| 32 | } // main
|
---|
| 33 |
|
---|
| 34 | // Local Variables: //
|
---|
| 35 | // tab-width: 4 //
|
---|
| 36 | // compile-command: "cfa random.c" //
|
---|
| 37 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.