Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/identity.c

    rb63e376 r86bd7c1f  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  8 22:15:08 2016
    13 // Update Count     : 13
     12// Last Modified On : Wed May 27 18:16:30 2015
     13// Update Count     : 2
    1414//
    1515
    16 #include <fstream>
     16#include "fstream.h"
    1717
    18 forall( otype T )
     18forall( type T )
    1919T identity( T t ) {
    2020        return t;
     
    2222
    2323int main() {
    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;
     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';
    3434}
    3535
    3636// Local Variables: //
    3737// tab-width: 4 //
    38 // compile-command: "cfa identity.c" //
     38// compile-command: "cfa identity.c fstream.o iostream.o" //
    3939// End: //
Note: See TracChangeset for help on using the changeset viewer.