Changes in src/examples/identity.c [86bd7c1f:b63e376]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/identity.c
r86bd7c1f rb63e376 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:16:30 201513 // Update Count : 212 // Last Modified On : Tue Mar 8 22:15:08 2016 13 // Update Count : 13 14 14 // 15 15 16 #include "fstream.h"16 #include <fstream> 17 17 18 forall( type T )18 forall( otype T ) 19 19 T identity( T t ) { 20 20 return t; … … 22 22 23 23 int main() { 24 ofstream *sout = ofstream_stdout();25 char c = 'a';26 c = identity( c );27 sout << c << ' ' << identity( c ) << '\n';28 int i = 5;29 i = identity( i );30 sout << i << ' ' << identity( i ) << '\n';31 double d = 3.2;32 d = identity( d );33 sout << d << ' ' << identity( d ) << '\n';24 sout | "char\t\t\t" | identity( 'z' ) | endl; 25 sout | "signed int\t\t" | identity( 4 ) | endl; 26 sout | "unsigned int\t\t" | identity( 4u ) | endl; 27 sout | "signed long int\t\t" | identity( 4l ) | endl; 28 sout | "unsigned long int\t" | identity( 4ul ) | endl; 29 sout | "signed long long int\t" | identity( 4ll ) | endl; 30 sout | "unsigned long long int\t" | identity( 4ull ) | 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; 34 34 } 35 35 36 36 // Local Variables: // 37 37 // tab-width: 4 // 38 // compile-command: "cfa identity.c fstream.o iostream.o" //38 // compile-command: "cfa identity.c" // 39 39 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.