Last change
on this file since e15293b was
200fcb3,
checked in by Peter A. Buhr <pabuhr@…>, 6 years ago
|
add auto newline to sout, change endl to nl
|
-
Property mode set to
100644
|
File size:
961 bytes
|
Rev | Line | |
---|
[73abe95] | 1 | // |
---|
[08d14cf] | 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
[73abe95] | 6 | // |
---|
[dc8511c] | 7 | // div.cfa -- |
---|
[73abe95] | 8 | // |
---|
[08d14cf] | 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Tue Aug 8 16:28:43 2017 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[200fcb3] | 12 | // Last Modified On : Tue Dec 4 21:35:01 2018 |
---|
| 13 | // Update Count : 20 |
---|
[73abe95] | 14 | // |
---|
[08d14cf] | 15 | |
---|
[73abe95] | 16 | #include <fstream.hfa> |
---|
[200fcb3] | 17 | #include <stdlib.hfa> // div |
---|
[08d14cf] | 18 | |
---|
| 19 | struct T { int i; }; |
---|
| 20 | T ?/?( T t1, T t2 ) { return t1.i / t2.i; } |
---|
| 21 | T ?%?( T t1, T t2 ) { return t1.i % t2.i; } |
---|
[09687aa] | 22 | ofstream & ?|?( ofstream & os, T t ) { return os | t.i; } |
---|
[08d14cf] | 23 | |
---|
| 24 | int main( void ) { |
---|
[200fcb3] | 25 | sout | "div" | div( 13, 5 ) | div( 13L, 5L ) | div( 13LL, 5LL ); |
---|
[08d14cf] | 26 | short s1 = 13, s2 = 5; |
---|
[200fcb3] | 27 | sout | "div" | div( s1, s2 ); |
---|
[08d14cf] | 28 | T t1 = { 13 }, t2 = { 5 }; |
---|
[200fcb3] | 29 | sout | "div" | div( t1, t2 ); // polymorphic div |
---|
[08d14cf] | 30 | } // main |
---|
| 31 | |
---|
| 32 | // Local Variables: // |
---|
| 33 | // tab-width: 4 // |
---|
[dc8511c] | 34 | // compile-command: "cfa div.cfa" // |
---|
[08d14cf] | 35 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.