	 k w1w1by name         by name         BUILD           d   	kH      A                                                ./               A          A          
k H m            w1w1w1
                ./lpp_name               m          m          4 R S xlC.C++ {
xlC.C++.tutorial 3.1.3.1 01 N U en_US C Set ++ Tutorial
[
*prereq xlC.C++.tutorial 3.1.3.0
%
/usr/lpp/xlC/tutorial 24
/usr/lpp/SAVESPACE 296
/usr/lib/objrepos 16
/usr/lpp/xlC/tutorial/source 272
INSTWORK 64 24
%
%
%
IX55924  1 Missing C++ tutorial source files
%
]
}
     	k\      A                                                ./usr            A          A          
k{      A                                                ./usr/lpp                A          A          kꊉ      A                                                ./usr/lpp/xlC.C++/xlC.C++.tutorial/3.1.3.1               A          A          k[ @ m            w1w1w1
                 ./usr/lpp/xlC.C++/xlC.C++.tutorial/3.1.3.1/liblpp.a              m          m          <aiaff>
7588        0           68          7338        0           28          196         0           828141730   1590        400         644         9   productid `
xlC.C++.tutorial 5765-42100
268         580         68          828141729   1590        400         644         26  xlC.C++.tutorial.copyright`
 Licensed Materials - Property of IBM

 576542100
   (C) Copyright International Business Machines Corp. 1994, 1995.

 All rights reserved.
 US Government Users Restricted Rights - Use, duplication or disclosure
 restricted by GSA ADP Schedule Contract with IBM Corp.
5420        6116        196         829944760   1590        400         644         26  xlC.C++.tutorial.inventory`
/usr/lpp/xlC/tutorial/3-4.out:
          owner = bin
          group = bin
          mode = 555
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 11309
          checksum = "04678    12 "

/usr/lpp/xlC/tutorial/source/11-10-2.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 362
          checksum = "11686     1 "

/usr/lpp/xlC/tutorial/source/11-13-10.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 536
          checksum = "05100     1 "

/usr/lpp/xlC/tutorial/source/11-13-11.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 677
          checksum = "12230     1 "

/usr/lpp/xlC/tutorial/source/11-13-12.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 747
          checksum = "56508     1 "

/usr/lpp/xlC/tutorial/source/11-13-9.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 581
          checksum = "31443     1 "

/usr/lpp/xlC/tutorial/source/11-2-1.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 407
          checksum = "57591     1 "

/usr/lpp/xlC/tutorial/source/11-8-5.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 13908
          checksum = "55579    14 "

/usr/lpp/xlC/tutorial/source/11-8-9.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 14418
          checksum = "12255    15 "

/usr/lpp/xlC/tutorial/source/12-1-5.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 356
          checksum = "59312     1 "

/usr/lpp/xlC/tutorial/source/12-2-3.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 564
          checksum = "39268     1 "

/usr/lpp/xlC/tutorial/source/12-8-12.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 925
          checksum = "26650     1 "

/usr/lpp/xlC/tutorial/source/13-2-3.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 877
          checksum = "01673     1 "

/usr/lpp/xlC/tutorial/source/13-2-4.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 825
          checksum = "07264     1 "

/usr/lpp/xlC/tutorial/source/13-6-7.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 6270
          checksum = "26628     7 "

/usr/lpp/xlC/tutorial/source/14-3-1.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 1014
          checksum = "57904     1 "

/usr/lpp/xlC/tutorial/source/14-3-4.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 997
          checksum = "48745     1 "

/usr/lpp/xlC/tutorial/source/14-3-5.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 998
          checksum = "44137     1 "

/usr/lpp/xlC/tutorial/source/14-4-3.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 1010
          checksum = "36123     1 "

/usr/lpp/xlC/tutorial/source/14-5-6.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 9622
          checksum = "05754    10 "

/usr/lpp/xlC/tutorial/source/15-2-2.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 5117
          checksum = "29541     5 "

/usr/lpp/xlC/tutorial/source/15-2-5.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 1250
          checksum = "27899     2 "

/usr/lpp/xlC/tutorial/source/15-3-6.C:
          owner = bin
          group = bin
          mode = 444
          type = FILE
          class = apply,inventory,xlC.C++.tutorial
          size = 11046
          checksum = "54514    11 "

102         6330        580         829944760   1590        400         644         21  xlC.C++.tutorial.size `
/usr/lpp/xlC/tutorial 24
/usr/lpp/SAVESPACE 296
/usr/lib/objrepos 16
/usr/lpp/xlC/tutorial/source 272
898         7338        6116        829944760   1590        400         644         19  xlC.C++.tutorial.al `
./usr/lpp/xlC/tutorial/3-4.out
./usr/lpp/xlC/tutorial/source/11-10-2.C
./usr/lpp/xlC/tutorial/source/11-13-10.C
./usr/lpp/xlC/tutorial/source/11-13-11.C
./usr/lpp/xlC/tutorial/source/11-13-12.C
./usr/lpp/xlC/tutorial/source/11-13-9.C
./usr/lpp/xlC/tutorial/source/11-2-1.C
./usr/lpp/xlC/tutorial/source/11-8-5.C
./usr/lpp/xlC/tutorial/source/11-8-9.C
./usr/lpp/xlC/tutorial/source/12-1-5.C
./usr/lpp/xlC/tutorial/source/12-2-3.C
./usr/lpp/xlC/tutorial/source/12-8-12.C
./usr/lpp/xlC/tutorial/source/13-2-3.C
./usr/lpp/xlC/tutorial/source/13-2-4.C
./usr/lpp/xlC/tutorial/source/13-6-7.C
./usr/lpp/xlC/tutorial/source/14-3-1.C
./usr/lpp/xlC/tutorial/source/14-3-4.C
./usr/lpp/xlC/tutorial/source/14-3-5.C
./usr/lpp/xlC/tutorial/source/14-4-3.C
./usr/lpp/xlC/tutorial/source/14-5-6.C
./usr/lpp/xlC/tutorial/source/15-2-2.C
./usr/lpp/xlC/tutorial/source/15-2-5.C
./usr/lpp/xlC/tutorial/source/15-3-6.C
135         7588        6330        829944757   1590        400         644         24  xlC.C++.tutorial.fixdata`
fix:
	name = IX55924
	abstract = Missing C++ tutorial source files
	type = f
	filesets = "xlC.C++.tutorial:3.1.3.1\n\
"
	symptom = ""

 215         0           7338        0           0           0           0           0   `
6           68          196         580         6116        6330        7338        productid xlC.C++.tutorial.copyright xlC.C++.tutorial.inventory xlC.C++.tutorial.size xlC.C++.tutorial.al xlC.C++.tutorial.fixdata    k)   m        -,  w1D9X1D9X1
           -,      ./usr/lpp/xlC/tutorial/3-4.out           m          m           .  +    H            h                  1L                      .pad                                .text                     2      .pad              P                 .data                        $     @.bss                                .pad                               .loader                                                                                                                                                                     |mx|#x|+xB   9     2    2   H  uO2  i  }sx}{x 09     H O   ,  A  h  H 	A |                                    |0u   !`;   L:    Hb H EA 2 X8` 8  8P H QA ,   8 <9  @ D X,  A 48  }3|g.8  ,  1 }#HA |g.8  ,  K <0h Tg<|c8Tc:|c Ѐ  3? DTc 6|n2 8 D @ 2! @2A <3 3 i <8  Tg:|c8 8Th8V:|tTc80 @|.0i H}@.s @~3~  8}  H O,  8}  0 A H uO,  3 ;P  A  3 ),  @ } pc P, @ T}8  , _8{  8 8 @ 83 )8  H O@ $} | , / @ AA3Z | 3{ @ } pc P, @Ks  ,  ~sA 3 3 i <8  K܀ D @T<|@ =  T:}9. D @Tg<|c8Tc:|h  D @Tg<|c8Tc:|h#  D @0  D 8 H A  D @,  8`  < @ H@XV<|p @Tc:@^ }#@.UH8|i@}i@.c ,  |@A LA H A ^ 1J   UH8^ |g@}g@.c ,  |@A AKȀ D <2 |8  <@ V<|p @Tc:Kpy   Tg<|c8|Tc:|.y  Tg<|c8Tc:~.y  Tg<|c8Tc:|.  ,@ , |.y  Tg<|c8Tc:|.0 |.H  ~.y  0c y  KH  8` cH A 8`  H A   DT<|g8  Tc: HH A  Du @T<|@T: @H )O!   }N       	(a    P      H __C_runtime_startup    8` |  @A 8`A 8`  N       	 @          $ PrioFcn__FPCvPCv  b | < ,  !;  8    @ D@ 0T<|( @T:|( 8  <,  A 0ef   8`  T8|  ,   A 8 8 @d   Tc8|c c H 9A H  8`  H A 8    8 @ ,  A 0ef   8`  Kb  <,   @@ 0T<|( @K4 @!   }N       	(a    (      @ __C_runtime_termination__Fv  KL     	 @        __glab1   K     	 @        __glab2        A   L |	N            A   L |	N           8  ||+|"*A H|8@@@@ |A L  H  p|+|*A $0  |8@@@|+@ P@ D|*@|,     T A |0|0|8@H  |8@|0}0@@@ L  A A 8`N  8` N  8`  N                                     |2|0T}	TA  }$}%$0c |H@0 AL  ,
  }IA    %  0c |H@0 AL  |0 M  OA |+x|3xOB9   =)  | T}	TA }$0c |H@A@ $,
  }IM    0c (  AM  L L!N                  $_clc   A   L |	N             A |	K k N N                                      $A   L |	N            (A   L |	N            ,A   L |	N           |fx|#x|3xTA ||$*|*N  |@@ }D(|P@|	8   |Ta |dA (|$*|%*0  B ||$*|%*a N  |(0|$*|%*B | ||$*|%*a N                                     | ! 4a h la ha lKmA  L X|0! PN       	 A       @ $__ls__7ostreamFPFR7ostream_R7ostream  | ! 4a ha h8H  e,  A a hc c H H  8`H   L X|0! PN       	 A       \ peek__7istreamFv  | ! 4a x |a |,  A a xc c Tca 8H  a xc c a 8a 8,  A a x |H A H  8` H   \ h|0! `N       	 A        ipfx__7istreamFi  | ! 4a x xd  | @A (a x   e |c KA a 8H  a xc c  Tc>a 8a 8 \ h|0! `N       	 A       | sgetc__9streambufFv   | ! 48  a 8 <8}  0 H  A  D8  Km8}  0 	H  A 8  KU H8~  88 
H  A 8~  K,  @ b HK,  A H  K X|0! PN       	 A     main       8A   L |	N            @A   L |	N            LA   L |	N           /usr/lib/libc.a /usr/lib/profiled/libc.a __cdtors       ABCDE 

 Press <ENTER> to return to the tutorial.      
                                                                                                                                                                                                                                                                                                                                                            ޭ          p            ޭ          |                                                              l                                     @   `                         x                                                                                                                                                                                                                                                                                                                 $   =         r  ]atexit        @
                    @
       qsort         @
       exit          @
                    @
       malloc        @
       errno         @                    @
       cout          @              5      @
              J      @
       cin           @              ]      @
       __start    h !
                                                    <        h         l        p         t        |                                                                                                                                                       	                 
                                          /usr/lpp/xlC/lib:/usr/lib:/lib    libc.a shr.o  libC.a shr.o  
loadquery  __CleanupCatch  do_ipfx__7istreamFi  __ls__7ostreamFPCc  endl__FR7ostream  ignore__7istreamFiT1        ,   <  F   
  P   "  p        L     T     
     
  r   F     o
     o
  @   Z
     4     X  $   
     _
     
     v
     L     
     i
  n   L     _
     v
  V   L  	     	6     "             x          $     _
  B   $     $     
  z   $     _
  "   $  .   (  8   
  B   *  T   
  f   ,  t   
     ,                                                  P    <   N    h        l       p   B    t       |   D              @              >                     J       R                     H       2       V                     r                     &                     {                      .__start                     __start    h           
      _adata         k              TOC           k               _adata        k              errno         k              p_xargc                     p_xargv                     p_xrcfg                     p_xrc                       .file      .  g3-4.C                              3-4.o                        k                      *     k                      P  0   k                      b     k                      t  h   k               .main                                     k                        x   k   8           cout          k                           k              cin           k              .file      6  gcdtors.C                           cdtors.o         _cdtors    `           !      _cdtors       k              .file      \  gstartup.C                          startup.o                    k  p                           :                         k   :                     l   k   :            .__glab1     k   :            .__glab2     k   :                          k                        @   k   2           _$STATIC      k   D     !      _$STATIC      k              __glab2    |   k        
      __glab1    p   k        
                  k        
                   k                    <      k        
            M      k              ._clc     
0                  ptrgl.s    q  g ._ptrgl   D   k   @            ._ptrgl   D      ]            .$PTRGL   D      ]            .bcopy       k               .bcopy          c            .ovbcopy        c            ._moveeq        c            .memcpy         c            .memmove        c            .strcmp   	X                  glink.s    z  g       ^                  
            m     k   $                 }        t                       k              glink.s      g                         
                 k   $                         }                       k              glink.s      g                         
                 k   $                                          +      k              glink.s      g       @                  
            T     k   $                 i                         ~      k              glink.s      g                         
              	4   k   $                   	4                             k              glink.s      g malloc                    
      .malloc      k   $           .malloc                    malloc        k              glink.s      g atexit                    
      .atexit   	   k   $           .atexit   	                 atexit        k              glink.s      g exit                      
      .exit        k   $           .exit                      exit          k              glink.s      g qsort                     
      .qsort        k   $           .qsort                      qsort         k              gen.file  g cout                            cin                                                      
      errno                             .__ls__7ostreamFPFR7ostream_R7ostream .__ls__7ostreamFPFR7ostream_R7ostream .peek__7istreamFv .ipfx__7istreamFi .sgetc__9streambufFv endl__FR7ostream endl__FR7ostream .__C_runtime_startup .__C_runtime_startup .PrioFcn__FPCvPCv .__C_runtime_termination__Fv __C_runtime_termination__Fv __C_runtime_termination__Fv PrioFcn__FPCvPCv PrioFcn__FPCvPCv __CleanupCatch .__CleanupCatch .__CleanupCatch __CleanupCatch __ls__7ostreamFPCc .__ls__7ostreamFPCc .__ls__7ostreamFPCc __ls__7ostreamFPCc ignore__7istreamFiT1 .ignore__7istreamFiT1 .ignore__7istreamFiT1 ignore__7istreamFiT1 do_ipfx__7istreamFi .do_ipfx__7istreamFi .do_ipfx__7istreamFi do_ipfx__7istreamFi loadquery .loadquery .loadquery loadquery v  k #` $        j  w1Ď00
         }`  j      ./usr/lpp/xlC/tutorial/source/11-10-2.C          $          $          #include <strstream.h>

void main() {
   char c;
   char* buf_in = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   istrstream in_stream(buf_in);    // declare input stream
   while ( in_stream >> c ) {
         cout << c << endl;
   }
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
 k   k $` $          w1Ŏ00
         ~`        ./usr/lpp/xlC/tutorial/source/11-13-10.C                 $          $          #include <iostream.h>      // include I/O Stream definitions
#include <iomanip.h>       // include manipulator definitions

void main() {
   float f =6.6666666;
   cout.precision(2); // set floating-point precision of cout
   cout << "Here is f with precision 2: " << f << endl;
   cout << "Here is f with precision 4: "
        << setprecision(4) << f << endl;
// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
k1 %` $          w1Ŏ00
         `        ./usr/lpp/xlC/tutorial/source/11-13-11.C                 $          $          #include <iostream.h>     // include I/O Stream definitions
#include <iomanip.h>      // include manipulator definitions

void main() {
   int first_val, sec_val;
   cout << " Please enter two integer values " << endl;
   cin >> first_val >> sec_val;
   cout.width(30);
   cout << " Here is first_val "  // field padded to width 30
        << setw(15) << first_val  // field padded to width 15
        << " sec_val " <<         // field not padded
        sec_val << endl;          // field not padded

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
   kJ &` $          w1Ǝ00
         `        ./usr/lpp/xlC/tutorial/source/11-13-12.C                 $          $          #include <iostream.h>      // include I/O Stream definitions
#include <iomanip.h>       // include manipulator definitions

void main() {
   int first_val, sec_val;
   cout << "Enter two integer values " << endl;
   cin >> first_val >> sec_val;
   cout.fill('&'); // set the fill character to '&'
   cout.width(30);
   cout << " Here is first_val "  // field padded to width 30
        << setfill('-')
        << setw(15) << first_val  // field padded to width 15
        << " sec_val " <<         // field not padded
        sec_val << endl;          // field not padded

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
     k  '` $        E  w1Ǝ00
         `  E      ./usr/lpp/xlC/tutorial/source/11-13-9.C          $          $          #include <iostream.h>

void main() {
   int first_val, sec_val, third_val;
   cout << "Please enter a decimal, oct, and hex value"
        << endl;
   cin >> first_val >> oct >> sec_val;
   cin >> hex >> third_val;
   cout << "Here are the decimal values "
        << "of the values you entered "
        << endl;
   cout << first_val << " "
        << sec_val << " "
        << third_val
        << endl;

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
t tkr (` $          w1Ǝ00
         `        ./usr/lpp/xlC/tutorial/source/11-2-1.C           $          $          // \EXAMPLES\EX1101.CPP

#include <iostream.h>

void main() {
   char name[50];
   int age;
   cout << "Please type in your name and age and hit ENTER"
        << endl;
   cin >> name >> age;
   cout << "Hello " << name << ", your age is " << age
        << endl;

   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
/l`2 )` $        T6  w1ǎ00
         `        ./usr/lpp/xlC/tutorial/source/11-8-5.C           $          $             		  -
/aeinortcdmsu();<=Fflp&,.1:>bgvy{"*02hx}#+3kw%'6?CEP[]_j!457AHINRTX\8MODB(49.{eVb@ %dl9$mdIaB?8)C , Nb , N{
P `PP( p$[ 

`@p%l$*)%4C{{AaVHRZ`H,0:t" CŽmdj9$mdIaЈsK%ʒ@H/ŖD|=,,EUS-).S\NC^ȔTȹT{Kt#$L29ȹazzKUUUTL49/kzRUURű/kR dE-Qjʧ(IT$PB'(IQ$ŖD|=,-(L>`D>(P9KcZYmdRc\s449B?!JH>%14-`z4lzԄDIz9$md=.a{\4/kRsK	4 AJ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ɩ%qꪉKGS4	 uUUUU!rť[UT$$4P[Li."[2[\#4ב5窪Yqr\hp@(
UUTKfZke=UQ!t0A@UUUUTOlNH-Myꪖd=ELUUUUUR9I*Icܶ=EL
JaF"\{b[\"zd0Ș02)Libꪩ-K窪XLL c`
S\6
UU!!$AGr4	.ŖDǈܒ^UNSs%,ӝ΄E:k	zlSt"[ɇ$m`DT1dL49/kak`"=,|&aFQ)湐!0]UUUUTE6c_-
sJKc稲0ن0[.ibL4lK@1qJcKz)Lip,Ӕ\,ӝ΄Cܵ0y%k"hi"EQ-`b퇐j^DZ<GsCH(RH	%1$
809O5̊i$pK,R
i$pIJcK,ӝ΄Cܵ0y%k%B'TKX {eS[w$Ü^(<2K	)Lib9Џ:4AN ԕ4CkE"ձ.<=dsKT佮Dĵ>𠈖Ü^
pal|l<(%!ࠒƗ0PK.CJSXl<($1x($1=9O5̇9$m`(Y8$;H{]k|9%kA-a9$m`<<(xPK.CA%).ࠖ\4gPxPIJcKPIJcKzrkrIz,(PNqI/[XvS&%1$D>PKcCaA,4ŞCaA%).CA%),Yyd9%k B99$maENK	k|9%kA-a9$m`<<(xPK.CA%),Yl|T6RD<KzrkrIz,(PNt#9 ՕH(sKC5ܒ@<]UUUHDIs#kZ1ja*:b-M| {]rIzɡADbD@p-S*BTAHV P  =k2$\dI" H<V`dJ.B&)Tt"Q!$0=ˆr$"a
%2*Y$ 8\pj>2%Y
%2S
 ,:sK"휧Ol^-$Q-5JaDZk 8d0 ydT^-$@Qg%ak$(	 `
, HRBs PENKk +` $        d  w1Ȏ00
         `  d      ./usr/lpp/xlC/tutorial/source/12-1-5.C           $          $          #include <iostream.h>

void print_int(unsigned int i) {
   cout << "Here is the int: " << i << endl;
}

void main() {
   int j = 4;
   int k = -4;
   print_int(j);
   print_int(k);

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
4p6kԾ ,` $        4  w1Ȏ00
         `  4      ./usr/lpp/xlC/tutorial/source/12-2-3.C           $          $          #include <iostream.h>

void print_int(int i) {
   cout << "Here is int value: " << i << endl;
}

void main() {
   float f = 3.0;
   float g = 3.12;
   print_int(f);           // automatic conversion float to int
                           // with no loss of information
   print_int(g);           // automatic conversion float to int
                           // with loss of information

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
Pk@ -` $          w1Ɏ00
         `        ./usr/lpp/xlC/tutorial/source/12-8-12.C          $          $          #include <iostream.h>

void f() {
   cout << "You called f() with no arguments." << endl;
}

void f(int i) {
   cout << "You called f(int): " << i << endl;
}

void f(float i, int j) {
   cout << "You called f(float, int) " << i
   << ",  " << j << endl;
}

void f(int i, float j) {
   cout << "You called f(int, float) " << i
   << ", " << j << endl;
}

void main() {
   int i = 3;
   short k = 5;
   float fl = 3.14;
   double dl = 1.33;
   f();             // invokes f()
   f(i);            // invokes f(int)
   f(fl);           // invokes f(int)
   f(i, fl);        // invokes f(int, float)
   f(fl, i);        // invokes f(float, int)
   f(dl, k);        // invokes f(float, int)
   //f(i, j);       // ambiguous: f(int, float) or f(float, int)

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
Kk .` $        m  w1Ɏ00
         `  m      ./usr/lpp/xlC/tutorial/source/13-2-3.C           $          $          #include <iostream.h>

class base1 {
   int i;
public:
   base1(int j = 3) : i(j) { }   // constructor for base class
   int geti() { return i; }      // function returns value of i
};

class derived1 : public base1 {  // derived1  derived from base1
public:
                                 // member of derived1 calls a
                                 // member of base1
   void printi() { cout << "Here is i " << geti() << endl; }
};

void main() {
   derived1 d;                   // define an object of derived1
   cout << "Here is i " << d.geti() << endl; // call base1 member
                                 // from object of derived1
   d.printi();                   // call derived1 member

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}

in.k /` $        9  w1ʎ00
         `  9      ./usr/lpp/xlC/tutorial/source/13-2-4.C           $          $          #include <iostream.h>

class base1 {
   int i;
public:
   base1(int j = 3) : i(j) { }   // constructor for base class
   int geti() { return i; }      // function returns value of i
};

class derived1 : public base1 {  // derived1 derived from base1
public:
   int geti() { return 0; }      // override of geti() in base1
   void printi() { cout << "Here is i " << geti() << endl; }
};

void main() {
   derived1 d;                   // define an object of derived1
   cout << "Here is i " << d.geti() << endl; // call base1 member
                                 // from object of derived1
   d.printi();                   // call derived1 member

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}

  cin.ik꼻 0` $        ~  w1ʎ00
         `  ~      ./usr/lpp/xlC/tutorial/source/13-6-7.C           $          $          // Example of STACKS using an abstract base class

#include <iostream.h>

class StackItem;           // forward declaration

//----------------------------------------------------
// CLASS Stack : a abstract base class for stacks that store
//               elements of type StackItem
//----------------------------------------------------

class Stack {
public:
   virtual void push(StackItem&) =0;
   virtual StackItem& pop() =0;
   virtual int empty() =0;
   virtual int full() =0;
   virtual void dumpStack() =0;
};

//----------------------------------------------------
// CLASS StackItem : A class for elements that are stored
//                   in Stack classes.
//----------------------------------------------------

class StackItem {
private:
   int value;
public:
   StackItem(int i = 0): value(i) { }
   int get() { return value; }
};

StackItem dummyItem;       // dummy StackItem to return on error

//----------------------------------------------------
// CLASS AStack : A class derived from Stack that
//                implements a stack as an array.
//----------------------------------------------------

class AStack: public Stack {
   int free;                // number of free elements in array
   int size;                // size of the array
   StackItem* pArray;       // pointer to the array
public:
   AStack( int capacity = 10);
   ~AStack();
        void push(StackItem&);
        StackItem& pop();
   int empty();
   int full();
   void dumpStack();
};

//----------------------------------------------------
// Definitions of inline functions for AStack
//----------------------------------------------------

void AStack::dumpStack() {
   int used = size - free;
        for (int i = 0; i < used; i++ ) {
                cout << pop().get() << endl;
      }
   }


AStack::AStack(int capacity) {
   pArray = new StackItem[capacity]; // allocate memory for array
   size = free = capacity;           //initialize size and free
}

AStack::~AStack() {
   delete[] pArray;                  // deallocate the array
}

void AStack::push(StackItem& s ) {
   if ( full() )
      cout << " Array full " << endl;
   else {
      pArray[size - free] = s;
      free--;
   }
}

StackItem& AStack::pop() {
   if ( empty() ) {
                cout << " Array empty " << endl;
                return dummyItem;
        }
        else {
        // return element on top of stack, remove it from stack
                return pArray[(size - free++) -1];
        }
}

int AStack::empty() {
        if ( free == size )       // if array empty, return true
                return 1;
   else
                return 0;              // otherwise return false
}

int AStack::full() {
   if ( free == 0 )          // if array is full, return true
      return 1;
   else
      return 0;              // otherwise, return false
}

//----------------------------------------------------
// CLASS LLStack : A class derived from Stack that
//                 implements a stack as a linked list.
//----------------------------------------------------

class LLStack: public Stack {
   struct Node                // structure for elements the list
   {
      StackItem datum;        // value of current element
      Node* next;             // pointer to next element
   };
   Node* pList;               // pointer to linked list
   int used;                  // number of elements now in list
public:
        LLStack( int size = 10);
   ~LLStack();
        void push(StackItem&);
   StackItem& pop();
   int empty();
   int full();
   void dumpStack();
};

//----------------------------------------------------
// Definitions of inline functions for AStack
//----------------------------------------------------



LLStack::LLStack( int ) {
        pList = NULL;
        used = 0;
}

LLStack::~LLStack() {
   Node* pTempNode = pList;
   while ( pTempNode != NULL ) {      // delete entire list
      pList = pList->next;
      delete pTempNode;
   }
}

void LLStack::push(StackItem& s) {
   Node* pNewNode = new Node;
   if ( pNewNode == NULL )
      cout << " Can't allocate stack " << endl;
   else {
      pNewNode->datum = s.get();      // assign data value
      pNewNode->next = pList;         // point to current list
      pList = pNewNode;               // --> to new node
      used++;
   }
}

StackItem& LLStack::pop() {
        Node* pTempNode = pList;
        if ( empty() ) {
                cout << " attempt to pop empty stack " << endl;
                return dummyItem;
        }
        else {
                StackItem& TempItem = pList->datum;
                pList = pList->next;
                delete pTempNode;       // delete node
                return TempItem;        // return data from node
        }
}

int LLStack::empty() {
   return ( pList == NULL );   // return true if list is empty
}

int LLStack::full() {
   return(0);                  // return false - list never full
}

void LLStack::dumpStack() {
   while ( pList != NULL ) {
      cout << pop().get() << endl;
   }
}

//----------------------------------------------------
// Simple client code that exercises the stack classes
//----------------------------------------------------

void useStack(Stack& stack) {
   for (int i=0; i < 10; i++) {
      StackItem s(i);        // define a StackItem
      stack.push(s);         // put StackItem on stack
   }
   stack.dumpStack();        // print and empty stack
   StackItem t(99);          // define a single StackItem
        stack.push(t);       // push it onto stack
                          // now pop item off stack and print it
   cout << "Here is top of stack: "
        << stack.pop().get() << endl;
}


//----------------------------------------------------
// Simple main() function to exercise AStack and LLStack
//----------------------------------------------------

void main() {
   AStack astack(10);        // define an Astack object
        LLStack llstack;
   cout << "Call client code with array stack " << endl;
   useStack(astack);
   cout << "Call client code with linked list stack " << endl;
   useStack(llstack);

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
   }
 =kx 1` $          w1ˎ00
         `        ./usr/lpp/xlC/tutorial/source/14-3-1.C           $          $          #include <iostream.h>

//---------------------------------------------------------
class base1 {
public:
  void message()
  { cout << "base1 definition called" << endl; }
};

//---------------------------------------------------------
class derived1: public base1 {
public:
  void message()
  { cout << "derived1 definition called" << endl; }
};

//---------------------------------------------------------
void useClass(base1* b) {
  b->message();
}

//---------------------------------------------------------
void main() {
  base1 b;
  base1* bp = &b;
  derived1 d;
  derived1* dp = &d;
  dp->message();     // derived1 definition of message() called
  bp->message();     // base1 definition of message() called
  useClass(dp);      // base1 definition of message() called
  useClass(bp);      // base1 definition of message() called

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}


esk괡 2` $          w1̎00
         `        ./usr/lpp/xlC/tutorial/source/14-3-4.C           $          $          #include <iostream.h>

//---------------------------------------------------------
class base1 {
public:
  virtual void message()
  { cout << "base1 definition called" << endl; }
};

//---------------------------------------------------------
class derived1: public base1 {
public:
  void message()
  { cout << "derived1 definition called" << endl; }
};

//---------------------------------------------------------
void useClass(base1* b) {
  b->message();
}

//---------------------------------------------------------
void main() {
  base1 b;
  base1* bp = &b;
  derived1 d;
  derived1* dp = &d;
  dp->message();     // derived1 definition called
  bp->message();     // base1 definition called
  useClass(dp);      // derived1 definition of message() called
  useClass(bp);      // base1 definition of message() called

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
cinkL 3` $          w1̎00
         `        ./usr/lpp/xlC/tutorial/source/14-3-5.C           $          $          #include <iostream.h>
//---------------------------------------------------------
class base1 {
public:
   virtual void message()
   { cout << "base1 definition called" << endl; }
};

//---------------------------------------------------------
class direct1 : public base1 {
public:
   void message()
   { cout << "direct1 definition called" << endl; }
};

//---------------------------------------------------------
class indirect1: public direct1 {
public:
   void message()
   { cout << "indirect1 definition called" << endl; }
};

//---------------------------------------------------------
void useClass(direct1* d) {
   d->message();
}

//---------------------------------------------------------
void main() {
   indirect1 id;
   direct1* idp = &id;
   useClass(idp);   // indirect1 definition of message() called

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}


inkd 4` $          w1͎00
         `        ./usr/lpp/xlC/tutorial/source/14-4-3.C           $          $          #include <iostream.h>
//--------------------------------------------------------------
class base1 {
public:
  virtual void f(int i)
    { cout << "int value is: " << i << endl; }
};

//--------------------------------------------------------------
class derived1 : public base1 {
public:
  void f(float f)            // overrides base1 definition
    { cout << "float value is: " << f << endl; }
  // int f(int i) { }        // error - return type doesn't match
};

//--------------------------------------------------------------
void main() {
  derived1 d;
  base1* bp = &d;
  d.f(3.0);                  // calls derived1 definition of f()
  d.f(2);                    // calls derived1 definition of f()
  bp->f(3.0);                // calls base1 definition of f()
  bp->f(2);                  // calls base1 definition of f()

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}



}


eskl 5` $        %  w1͎00
         `  %      ./usr/lpp/xlC/tutorial/source/14-5-6.C           $          $          //---------------------------------------------------------
#include <iostream.h>

// forward declaration of ListItem class.

class ListItem;


//----------------------------------------------------
// CLASS List : A base class for the classes
//              that implement specific kind of lists.
//----------------------------------------------------

class List {
public:
  virtual void add(ListItem&) =0;
  virtual int remove(ListItem&) =0;
  virtual void display() =0;
};

//----------------------------------------------------
// CLASS ListItem : A class for nodes that are stored
//                  in Lists.
//----------------------------------------------------

class ListItem {
private:
  int value;
public:
  ListItem(int i = 0): value(i) { }
  int operator==(const ListItem& li)
  { return ( value == li.value); }
  ListItem& operator=(const ListItem& li)
  { value = li.value; return (*this); }
  int get() { return value; }
};


//----------------------------------------------------
// CLASS SLList : A class that implements a List as a
//                singly-linked list.
//----------------------------------------------------

class SLList : public List {
  struct Node               // structure for nodes in the list
  {
    ListItem datum;         // value of current node
    Node* next;             // pointer to next node
  };
  Node* pList;              // pointer to beginning of list
  Node* last();             // return pointer to last node
public:
  SLList();                 // constructor
  ~SLList();                // destructor
  void add(ListItem&);      // add node to list
  int remove(ListItem&);    // remove from list
  void display();           // display contents of list
};

//----------------------------------------------------
// constructor for SLList
//----------------------------------------------------

SLList::SLList() {
  pList = NULL;
}

//----------------------------------------------------
// destructor for SLList
//----------------------------------------------------

SLList::~SLList() {
  Node* pTempNode;
  while ( pList != NULL ) {      // delete all the nodes in list
    pTempNode = pList;
    pList = pList->next;
    delete pTempNode;
    }
}

//----------------------------------------------------
// last() private member function
// It returns pointer to last node in list
//----------------------------------------------------

SLList::Node* SLList::last() {
  Node* currNode = pList;
  Node* retNode = NULL;
  while ( currNode != NULL ) {
    retNode = currNode;
    currNode = currNode->next;
  }
  return retNode;
}

//----------------------------------------------------
// add() - add a node to a list
//----------------------------------------------------

void SLList::add(ListItem& s) {
  Node* pNewNode = new Node;
  if ( pNewNode == NULL )
    cout << " Can't allocate list " << endl;
  else {
    Node* lastNode = last();
    pNewNode->datum = s;           // assign data value
    pNewNode->next = NULL;         //
    if ( lastNode != NULL )
      lastNode->next = pNewNode;   // last node in existing list
                                   // points to new node
    else
      pList = pNewNode;            // this is first item in list
    }
}

//----------------------------------------------------
// remove() remove a node from the list.  Any nodes that match
//          the value of the argument are removed from the list.
//----------------------------------------------------

int SLList::remove(ListItem& li) {
  Node* currNode = pList;
  Node* prevNode = NULL;
  Node* nextNode;
  int retval = 0;
  while (currNode != NULL) {
    nextNode = currNode->next;  // keep pointer to next node
    if (currNode->datum == li)  // if datum matches, remove node
    {
      retval = 1;               // set return value
      if ( prevNode == NULL )   // is this beginning of list?
        pList = currNode->next; // List begins at next node
     else                     // skip current node in link chain
        prevNode->next = currNode->next;
      delete currNode;          // delete current node
    }
    else
      prevNode = currNode;      // advance previous node pointer
    currNode = nextNode;        // advance current node pointer
  }
  return retval;
}

//----------------------------------------------------
// display() - print all of the nodes in the list
//----------------------------------------------------

void SLList::display() {
  Node* currNode = pList;
  cout << "List contains:" << endl;
  while ( currNode != NULL ) {
    cout << currNode->datum.get() << endl;
    currNode = currNode->next;
  }
}

//----------------------------------------------------
// CLASS DLList : A class that implements a List as a
//                doubly-linked list.
//----------------------------------------------------

class DLList : public List {
  struct Node            // structure for nodes in the list
  {
    ListItem datum;      // value of current node
    Node* prev;          // pointer to previous node
    Node* next;          // pointer to next node
  };
  Node* pList;           // pointer to beginning of linked list
  Node* last();          // return pointer to last node in list
public:
  DLList();              // constructor
  ~DLList();             // destructor
  void add(ListItem&);   // add node to list
  int remove(ListItem&); // remove nodes from list
  void display();        // display contents of list
};

//----------------------------------------------------
// constructor for DLList
//----------------------------------------------------

DLList::DLList() {
  pList = NULL;
}

//----------------------------------------------------
// destructor for DLList
//----------------------------------------------------

DLList::~DLList() {
  Node* pTempNode;
  while ( pList != NULL ) {   // delete all the nodes in the list
    pTempNode = pList;
    pList = pList->next;
    delete pTempNode;
    }
}

//----------------------------------------------------
// last() - private member function
//          returns pointer to last node in list
//----------------------------------------------------

DLList::Node* DLList::last() {
  Node* currNode = pList;
  Node* retNode = NULL;
  while ( currNode != NULL ) {
    retNode = currNode;
    currNode = currNode->next;
  }
  return retNode;
}

//----------------------------------------------------
// add() - add a node to a list
//----------------------------------------------------

void DLList::add(ListItem& s) {
  Node* pNewNode = new Node;
  if ( pNewNode == NULL )
    cout << " Can't allocate list " << endl;
  else {
    Node* lastNode = last();
    pNewNode->datum = s;           // assign data value
    pNewNode->next = NULL;         //
    if ( lastNode != NULL )  {
      lastNode->next = pNewNode;   // last node in existing list
                                   // points to new node
      pNewNode->prev = lastNode;   // new node points back to
                                   // last node in existing list
    }
    else {
      pNewNode->prev = NULL;       // this is first item in list
      pList = pNewNode;
    }
  }
}

//----------------------------------------------------
// remove() - remove nodes from the list.  Any ListItems
//            that match the value of the argument are removed
//----------------------------------------------------

int DLList::remove(ListItem& li) {
  Node* currNode = pList;
  Node* nextNode;
  int retval = 0;
  while (currNode != NULL) {
    nextNode = currNode->next;      // keep pointer to next node
    if (currNode->datum == li)      // if matches, remove node
    {
      retval = 1;                   // set return value
      if ( currNode->prev == NULL ) // beginning of list?
        pList = currNode->next;     // List begins at next node
     else                      // skip current node in link chain
        currNode->prev->next = currNode->next;
      delete currNode;              // delete current node
    }
    currNode = nextNode;          // advance current node pointer
  }
  return retval;
}

//---------------------------------------------------------
// display() - print all of the nodes in the list
//---------------------------------------------------------

void DLList::display() {
  Node* currNode = pList;
  cout << "List contains:" << endl;
  while ( currNode != NULL ) {
    cout << currNode->datum.get() << endl;
    currNode = currNode->next;
  }
}

//----------------------------------------------------
// FUNCTION useClass : client code to exercise List classes.
// parameters:  List& lp  -  reference to List class object
//----------------------------------------------------

void useClass(List& lp) {
  for ( int i = 0; i < 10; i++ ) {  // put nodes in the list
    ListItem li(i);                 // define a ListItem object
    lp.add(li);                     // add this ListItem to list
  }
  lp.display();                     // display List
  ListItem li(0);                   // add another node with
  lp.add(li);                       // value = 0 to the list
  lp.display();
  lp.remove(li);             // remove both nodes with value = 0
  lp.display();
}

//----------------------------------------------------
void main() {
  SLList sl;
  DLList dl;
  useClass(sl);            // call client code with SLList object
  useClass(dl);            // call client code with DLList object

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
//----------------------------------------------------
--k 6` $          w1͎00
         `        ./usr/lpp/xlC/tutorial/source/15-2-2.C           $          $          #ifndef STRCLASS_H
#define STRCLASS_H

//--------------------------------------------------------------
#include <iostream.h>         // stream input and output
#include <string.h>           // string manipulation functions

//--------------------------------------------------------------
class String {                // data members
  char* text;                    // pointer to the characters
  int len;                       // number of chars in String
  int size;                      // allocated space for chars
public:                          // member functions
  String(int maxlen = 0);             // default constructor
  String( const String& s);           // copy constuctor
  String( char* s);                   // convert  char* to String
  ~String();                          // destructor
  String& operator=( const String& s);// assignment operator
  friend ostream& operator<<( ostream& os, const String& s);
};

//--------------------------------------------------------------
// default constructor  ( optional maxlen defaults to 0 )
//--------------------------------------------------------------

String::String(int maxlen)        // allow room for maxlen chars
{ len = 0;                        // no characters in string
  size = maxlen+1;                // sized to hold terminator
  text = new char [size];         // allocate from free store
  strcpy( text, "");              // initialize to null string
}

//--------------------------------------------------------------
// copy constructor
//--------------------------------------------------------------

String::String( const String& s) // copy an existing String obj.
{ len = s.len;                   // same length as existing obj.
  size = len+1;                  // sized to hold terminator
  text = new char [size];        // allocate from free store
  strcpy( text, s.text);         // copy chars in existing obj.
}

//--------------------------------------------------------------
// constructor to convert from char*
//--------------------------------------------------------------

String::String( char* s)         // convert from existing char*
{ len = strlen(s);               // set same length of string
  size = len + 1;                // sized to hold terminator
  text = new char [size];        // allocate from free store
  strcpy( text, s);              // copy chars from char*
}

String::~String()

//--------------------------------------------------------------
// destructor
//--------------------------------------------------------------
{  delete[] text;               // deallocate free store
}

//---------------------------------------------------------------
// assignment operator  - sets one String equal to another
//---------------------------------------------------------------

String& String::operator=( const String& s)
{ len = s.len;                     // set length of String
  if ( len < size )                // test if chars fit
    strcpy ( text, s.text);        // yes - copy
  else                             // if chars don't fit
  { size = len + 1;                // +1 for terminator
    char* newtext = new char[size];// allocate free store
    strcpy( newtext, s.text);      // copy chars
    delete[] text;                 // destroy the old chars
    text = newtext;             // update pointer to chars
  }
  return *this;                    // return updated String
}

//--------------------------------------------------------------
// output operator
//--------------------------------------------------------------

ostream& operator<<( ostream& os, const String& s)
{  os << s.text;
   return os;
}

//--------------------------------------------------------------

#endif

//--------------------------------------------------------------
// template function swap()
//--------------------------------------------------------------
template <class T>
void swap ( T& a, T& b)
{  T temp;
   temp = a;
   a = b;
   b = temp;
};

//--------------------------------------------------------------
// main() - to exercise swap
//--------------------------------------------------------------
void main()
{  int i, j;
   float x, y;
   char buffer[80];                    // for Strings
   // swapping integers
   cout << "Enter 2 integers:  ";
   cin >> i >> j;
   cout << "These numbers in the opposite order are:  ";
   swap( i, j);
   cout << i << '\t' << j;
   cout << endl;
   // swapping floats
   cout << "Enter 2 floating point numbers:  ";
   cin >> x >> y;
   cout << "These numbers in the opposite order are:  ";
   swap( x, y);
   cout << x << '\t' << y;
   cout << endl;
   // swapping strings
   cout << "Enter 2 words:  ";
   cin >> buffer;
   String m(buffer);
   cin >> buffer;
   String n(buffer);
   cout << "These words in the opposide order are:  ";
   swap( m, n);
   cout << m << '\t' << n;
   cout << endl;

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
//--------------------------------------------------------------
tork| 7` $          w1Ύ00
         `        ./usr/lpp/xlC/tutorial/source/15-2-5.C           $          $          #include <iostream.h>              // stream input and output

//--------------------------------------------------------------
// template function swap()
//--------------------------------------------------------------
template <class T>
void swap ( T& a, T& b)
{  T temp;
   temp = a;
   a = b;
   b = temp;
}
//--------------------------------------------------------------
// a nontemplate swap function
//--------------------------------------------------------------

void swap ( float& x, float& y);
//-- -----------------------------------------------------------
// main() - to exercise swap
//--------------------------------------------------------------
void main()
{
  float x, y;
  // swapping float values
  cout << "Enter 2 floating point numbers:  ";
  cin >> x >> y;
  cout << "These numbers in the opposite order are:  ";
  swap( x, y);
  cout << x << '\t' << y;
  cout << endl;

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
//--------------------------------------------------------------

void swap ( float& x, float& y)
{
  cout << "(non template swap)  ";
  x = x + y;
  y = x - y;
  x = x - y;
}
g
  sik 8` $        &+  w1Ύ00
         `  &+      ./usr/lpp/xlC/tutorial/source/15-3-6.C           $          $          #ifndef ASTACK_H
#define ASTACK_H
#ifndef STRCLASS_H
#define STRCLASS_H

//--------------------------------------------------------------
#include <iostream.h>
#include <string.h>           // string manipulation functions

//---------------------------------------------------------
// TEMPLATE: class AStack: is used to define a class stack
//                         based on a array of type T
//---------------------------------------------------------
template<class T> class AStack
{
   friend class  AStackItr<T>;    // iterator class
   T             *pArray;         // pointer to the array
   unsigned long size;            // size of the array
   unsigned long free;            // number of free elements
public:
   //-----------------------------------------------------------
   // FUNCTION: Constructor allocates an array of specified size
   // PARAMETERS: long - capacity - the max number of elements
   // RETURN VALUE: none
   //-----------------------------------------------------------
   AStack( unsigned long capacity = 10);
   //-----------------------------------------------------------
   // FUNCTION: Destructor deallocates array
   // PARAMETERS: none
   // RETURN VALUE: none
   //-----------------------------------------------------------
   ~AStack();
   //-----------------------------------------------------------
   // FUNCTION: Push pushes an element of type T onto the stack
   // PARAMETERS: T y is an element of type T
   // RETURN VALUE: none
   //-----------------------------------------------------------
   void Push( const T y);
   //-----------------------------------------------------------
   // FUNCTION: Pop pops an element of type T from the stack
   // PARAMETERS: none
   // RETURN VALUE: returns the top element of the stack
   //-----------------------------------------------------------
   T Pop();
   //-----------------------------------------------------------
   // FUNCTION: Full returns true if stack is full, false
   //                otherwise
   // PARAMETERS: none
   // RETURN VALUE: int
   //----------------------------------------------------------
   inline int Full() const;
   //----------------------------------------------------------
   // FUNCTION: Empty returns true if stack is empty, false
   //                 otherwise
   // PARAMETERS: none
   // RETURN VALUE: int
   //----------------------------------------------------------
   inline int Empty() const;
   //----------------------------------------------------------
   // FUNCTION: NumElem returns the number of elements in stack
   // PARAMETERS: none
   // RETURN VALUE: long the number of elements in the stack
   //------------------------------------------------------
   long NumElem() const;
};

//----------------------------------------------------------
//  Inline member functions of ASTACK
//----------------------------------------------------------

template<class T> inline int
AStack<T>::Full() const
{ // if free is zero return true, false otherwise
   return ( free == 0);
}

template<class T> inline int
AStack<T>::Empty() const
{ // if free equals size return true, false otherwise
   return ( free == size);
}


template<class T> inline long
AStack<T>::NumElem() const
{ return (size - free);
}

//---------------------------------------------------------
// TEMPLATE: class ASTACKITR
//           to iterate through the elements of a stack
//---------------------------------------------------------
template <class T> class AStackItr
{ long             index;
   const T*         pArray;
   const AStack<T>* pStack;
public:
   // FUNCTION: constructor
   // PARAMETERS:
   AStackItr( const AStack<T>& stack);

   // FUNCTION: operator()
   // RETURN VALUE: the next element
   T& operator()();
};

//----------------------------------------------------------
//  Inline member functions of ASTACKITR
//----------------------------------------------------------
template<class T>
AStackItr<T>::AStackItr( const AStack<T>& stack)
 : index(0), pArray( stack.pArray), pStack(&stack)
{
}

template<class T> T&
AStackItr<T>::operator()()
{ if (pStack->Empty())
  {  cout << "Stack Empty: " << endl;
  }
  return (T&)pArray[index++];
}

#endif

//--------------------------------------------------------------
class String {                // data members
  char* text;                    // pointer to the characters
  int len;                       // number of chars in String
  int size;                      // allocated space for chars
public:                          // member functions
  String(int maxlen = 0);             // default constructor
  String( const String& s);           // copy constuctor
  String( char* s);                   // convert  char* to String
  ~String();                          // destructor
  String& operator=( const String& s);// assignment operator
  friend ostream& operator<<( ostream& os, const String& s);
};

//--------------------------------------------------------------
// default constructor  ( optional maxlen defaults to 0 )
//--------------------------------------------------------------

String::String(int maxlen)        // allow room for maxlen chars
{ len = 0;                        // no characters in string
  size = maxlen+1;                // sized to hold terminator
  text = new char [size];         // allocate from free store
  strcpy( text, "");              // initialize to null string
}

//--------------------------------------------------------------
// copy constructor
//--------------------------------------------------------------

String::String( const String& s) // copy an existing String obj.
{ len = s.len;                   // same length as existing obj.
  size = len+1;                  // sized to hold terminator
  text = new char [size];        // allocate from free store
  strcpy( text, s.text);         // copy chars in existing obj.
}

//--------------------------------------------------------------
// constructor to convert from char*
//--------------------------------------------------------------

String::String( char* s)         // convert from existing char*
{ len = strlen(s);               // set same length of string
  size = len + 1;                // sized to hold terminator
  text = new char [size];        // allocate from free store
  strcpy( text, s);              // copy chars from char*
}

String::~String()

//--------------------------------------------------------------
// destructor
//--------------------------------------------------------------
{  delete[] text;               // deallocate free store
}

//---------------------------------------------------------------
// assignment operator  - sets one String equal to another
//---------------------------------------------------------------

String& String::operator=( const String& s)
{ len = s.len;                     // set length of String
  if ( len < size )                // test if chars fit
    strcpy ( text, s.text);        // yes - copy
  else                             // if chars don't fit
  { size = len + 1;                // +1 for terminator
    char* newtext = new char[size];// allocate free store
    strcpy( newtext, s.text);      // copy chars
    delete[] text;                 // destroy the old chars
    text = newtext;             // update pointer to chars
  }
  return *this;                    // return updated String
}

//---------------------------------------------------------------
// output operator
//---------------------------------------------------------------

ostream& operator<<( ostream& os, const String& s)
{  os << s.text;
   return os;
}

//---------------------------------------------------------------
#endif

//--------------------------------------------------------------
// constructor
//--------------------------------------------------------------
template<class T>
AStack<T>::AStack( unsigned long capacity)
   : size (0), free(0), pArray( (T *)NULL)
{ pArray = new T[capacity];  // allocate array used to store data
   if ( pArray == (T *)NULL)
   { cout << "Memory allocation error: " << endl;
   }
   size = free = capacity;   // initialize size and free;
}


//--------------------------------------------------------------
// destructor
//--------------------------------------------------------------
template<class T>
AStack<T>::~AStack()
{ delete[] pArray;  // deallocate the array
}


//--------------------------------------------------------------
// function to push (add) item to stack
//--------------------------------------------------------------
template<class T> void
AStack<T>::Push( const T y)
{  // print message if stack full
   if ( Full())
      cout << "Stack Full: " << endl;
   else
   {
     pArray[size -free] = y; // store data a next pos
     free--;            // decrement the number of free elements
   }
}


//--------------------------------------------------------------
// function to pop (remove) item from stack
//--------------------------------------------------------------
template<class T> T
AStack<T>::Pop()
{  // terminate execution if stack empty
   if ( Empty())
   { cout << "Stack Empty:  " << endl;
   }
   // return top element and remove element from stack
   return pArray[(size - free++) - 1];
}
//--------------------------------------------------------------
// main()    user interactive pops and pushed items on a stack
//--------------------------------------------------------------
void main()
{  AStack<String> MyStack;         // declare a stack
   char buffer[80];                // used to input Stings
   char response = ' ';            // user commands:
   cout << "P(U)SH"  << endl;      //  U or u --> push item
   cout << "P(O)P"   << endl;      //  O or o --> pop item
   cout << "P(R)INT" << endl;      //  R or r --> print stack
   cout << " (Q)uit" << endl;      //  Q or q --> quit
   cout << endl;
   do
   {  cout << "Enter a command: ( U O R or Q ):  ";
      cin >> response;
      switch (response)
      {  case 'u':                 // push - read string and push
         case 'U': { cout << "Enter a word: ";
                     cin >> buffer;
                     String word(buffer);
                     MyStack.Push( word);
                     break; }
         case 'o':                 // pop - pop string and print
         case 'O': { String word = MyStack.Pop();
                      cout << word << endl;
                      break; }
         case 'r':                 // print - iterate and print
         case 'R': { AStackItr<String> next( MyStack);
                     for (int i = MyStack.NumElem(); i > 0; i--)
                     {  String word = next();
                        cout << word << endl; }
                     cout << "*END*" << endl;
                     break; }
         case 'q': response = 'Q'; // quit
         case 'Q': break;
         default : cout << response << " ? ";
                   break;
      }
   } while ( response != 'Q' );
}
//--------------------------------------------------------------
trk--------------------------------------------------------
void useClass(base1* b) {
  b->message();
}

//---------------------------------------------------------
void main() {
  base1 b;
  base1* bp = &b;
  derived1 d;
  derived1* dp = &d;
  dp->message();     // derived1 definition of message() called
  bp->message();     // base1 definition of message() called
  useClass(dp);      // base1 definition of message() called
  useClass(bp);      // base1 definition of message() called

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}


esk괡 2` $          w1̎00
         `        ./usr/lpp/xlC/tutorial/source/14-3-4.C           $          $          #include <iostream.h>

//---------------------------------------------------------
class base1 {
public:
  virtual void message()
  { cout << "base1 definition called" << endl; }
};

//---------------------------------------------------------
class derived1: public base1 {
public:
  void message()
  { cout << "derived1 definition called" << endl; }
};

//---------------------------------------------------------
void useClass(base1* b) {
  b->message();
}

//---------------------------------------------------------
void main() {
  base1 b;
  base1* bp = &b;
  derived1 d;
  derived1* dp = &d;
  dp->message();     // derived1 definition called
  bp->message();     // base1 definition called
  useClass(dp);      // derived1 definition of message() called
  useClass(bp);      // base1 definition of message() called

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}
cinkL 3` $          w1̎00
         `        ./usr/lpp/xlC/tutorial/source/14-3-5.C           $          $          #include <iostream.h>
//---------------------------------------------------------
class base1 {
public:
   virtual void message()
   { cout << "base1 definition called" << endl; }
};

//---------------------------------------------------------
class direct1 : public base1 {
public:
   void message()
   { cout << "direct1 definition called" << endl; }
};

//---------------------------------------------------------
class indirect1: public direct1 {
public:
   void message()
   { cout << "indirect1 definition called" << endl; }
};

//---------------------------------------------------------
void useClass(direct1* d) {
   d->message();
}

//---------------------------------------------------------
void main() {
   indirect1 id;
   direct1* idp = &id;
   useClass(idp);   // indirect1 definition of message() called

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}


inkd 4` $          w1͎00
         `        ./usr/lpp/xlC/tutorial/source/14-4-3.C           $          $          #include <iostream.h>
//--------------------------------------------------------------
class base1 {
public:
  virtual void f(int i)
    { cout << "int value is: " << i << endl; }
};

//--------------------------------------------------------------
class derived1 : public base1 {
public:
  void f(float f)            // overrides base1 definition
    { cout << "float value is: " << f << endl; }
  // int f(int i) { }        // error - return type doesn't match
};

//--------------------------------------------------------------
void main() {
  derived1 d;
  base1* bp = &d;
  d.f(3.0);                  // calls derived1 definition of f()
  d.f(2);                    // calls derived1 definition of f()
  bp->f(3.0);                // calls base1 definition of f()
  bp->f(2);                  // calls base1 definition of f()

// prompt to return to tutorial
   cout << "\n\n" << endl;
   cout << "Press <ENTER> to return to the tutorial." << endl;
   cin.ignore(1000,'\n');
   while (!cin.peek());
}



}


eskl 5` $        %  w1͎00
         `  %      ./usr/lpp/xlC/tutorial/source/14-5-6.C           $          $          //---------------------------------------------------------
#include <iostream.h>

// forward declaration of ListItem class.

class ListItem;


//----------------------------------------------------
// CLASS List : A base class for the classes
//              that implement specific kind of lists.
//----------------------------------------------------

class List {
public:
  virtual void add(ListItem&) =0;
  virtual int remove(ListItem&) =0;
  virtual void display() =0;
};

//----------------------------------------------------
// CLASS ListItem : A class for nodes that are stored
//                  in Lists.
//----------------------------------------------------

class ListItem {
private:
  int value;
public:
  ListItem(int i = 0): value(i) { }
  int operator==(const ListItem& li)
  { return ( value == li.value); }
  ListItem& operator=(const ListItem& li)
  { value = li.value; return (*this); }
  int get() { return value; }
};


//----------------------------------------------------
// CLASS SLList : A class that implements a List as a
//                singly-linked list.
//----------------------------------------------------

class SLList : public List {
  struct Node               // structure for nodes in the list
  {
    ListItem datum;         // value of current node
    Node* next;             // pointer to next node
  };
  Node* pList;              // pointer to beginning of list
  Node* last();             // return pointer to last node
public:
  SLList();                 // constructor
  ~SLList();                // destructor
  void add(ListItem&);      // add node to list
  int remove(ListItem&);    // remove from list
  void display();           // display contents of list
};

//----------------------------------------------------
// constructor for SLList
//----------------------------------------------------

SLList::SLList() {
  pList = NULL;
}

//----------------------------------------------------
// destructor for SLList
//----------------------------------------------------

SLList::~SLList() {
  Node* pTempNode;
  while ( pList != NULL ) {      // delete all the nodes in list
    pTempNode = pList;
    pList = pList->next;
    delete pTempNode;
    }
}

//----------------------------------------------------
// last() private member function
// It returns pointer to last node in list
//----------------------------------------------------

SLList::Node* SLList::last() {
  Node* currNode = pList;
  Node* retNode = NULL;
  while ( currNode != NULL ) {
    retNode = currNode;
    currNode = currNode->next;
  }
  return retNode;
}

//----------------------------------------------------
// add() - add a node to a list
//----------------------------------------------------

void SLList::add(ListItem& s) {
  Node* pNewNode = new Node;
  if ( pNewNode == NULL )
    cout << " Can't allocate list " << endl;
  else {
    Node* lastNode = last();
    pNewNode->datum = s;           // assign data value
    pNewNode->next = NULL;         //
    if ( lastNode != NULL )
      lastNode->next = pNewNode;   // last node in existing list
                                   // points to new node
    else
      pList = pNewNode;            // this is first item in list
    }
}

//----------------------------------------------------
// remove() remove a node from the list.  Any nodes that match
//          the value of the argument are removed from the list.
//----------------------------------------------------

int SLList::remove(ListItem& li) {
  Node* currNode = pList;
  Node* prevNode = NULL;
  Node* nextNode;
  int retval = 0;
  while (currNode != NULL) {
    nextNode = currNode->next;  // keep pointer to next node
    if (currNode->datum == li)  // if datum matches, remove node
    {
      retval = 1;               // set return value
      if ( prevNode == NULL )   // is this beginning of list?
        pList = currNode->next; // List begins at next node
     else                     // skip current node in link chain
        prevNode->next = currNode->next;
      delete currNode;          // delete current node
    }
    else
      prevNode = currNode;      // advance previous node pointer
    currNode = nextNode;        // advance current node pointer
  }
  return retval;
}

//----------------------------------------------------
// display() - print all of the nodes in the list
//----------------------------------------------------

void SLList::display() {
  Node* currNode = pList;
  cout << "List contains:" << endl;
  while ( currNode != NULL ) {
    cout << currNode->datum.get() << endl;
    currNode = currNode->next;
  }
}

//----------------------------------------------------
// CLASS DLList : A class that implements a List as a
//                doubly-linked list.
//----------------------------------------------------

class DLList : public List {
  struct Node            // structure for nodes in the list
  {
    ListItem datum;      // value of current node
    Node* prev;          // pointer to previous node
    Node* next;          // pointer to next node
  };
  Node* pList;           // pointer to beginning of linked list
  Node* last();          // return pointer to last node in list
public:
  DLList();              // constructor
  ~DLList();             // destructor
  void add(ListItem&);   // add node to list
  int remove(ListItem&); // remove nodes from list
  void display();        // display contents of list
};

//----------------------------------------------------
// constructor for DLList
//----------------------------------------------------

DLList::DLList() {
  pList = NULL;
}

//----------------------------------------------------
// destructor for DLList
//----------------------------------------------------

DLList::~DLList() {
  Node* pTempNode;
  while ( pList != NULL ) {   // delete all the nodes in the list
    pTempNode = pList;
    pList = pList->next;
    delete pTempNode;
    }
}

//----------------------------------------------------
// last() - private member function
//          returns pointer to last node in list
//----------------------------------------------------

DLList::Node* DLList::last() {
  Node* currNode = pList;
  Node* retNode = NULL;
  while ( currNode != NULL ) {
    retNode = currNode;
    currNode = currNode->next;
  }
  return retNode;
}

//----------------------------------------------------
// add() - add a node to a list
//----------------------------------------------------

void DLList::add(ListItem& s) {
  Node* pNewNode = new Node;
  if ( pNewNode == NULL )
    cout << " Can't allocate list " << endl;
  else {
    Node* lastNode = last();
    pNewNode->datum = s;           // assign data value
    pNewNode->next = NULL;         //
    if ( lastNode != NULL )  {
      lastNode->next = pNewNode;   // last node in existing list
                                   // points to new node
      pNewNode->prev = lastNode;   // new node points back to
                                   // last node in existing list
    }
    else {
      pNewNode->prev = NULL;       // this is first item in list
      pList = pNewNode;
    }
  }
}

//----------------------------------------------------
// remove() - remove nodes from the list.  Any ListItems
//            that match the value of the argument are removed
//----------------------------------------------------

int DLList::remove(ListItem& li) {
  Node* currNode = pList;
  Node* nextNode;
  int retval = 0;
  while (currNode != NULL) {
    nextNode = currNode->next;      // keep pointer to next node
    if (currNode->datum == li)      // if matches, remove node
    {
      retval = 1;                   // set return value
      if ( currNode->prev == NULL ) // beginning of list?
        pList = currNode->next;     // List begins at next node
     else                      // skip current node in link chain
        currNode->prev->next = currNode->next;
      delete currNode;              // delete current node
    }
    currNode = nextNode;          // advance current node pointer
  }
  return retval;
}

//---------------------------------------------------------
// display() - print all of the nodes in the list
//---------------------------------------------------------

void DLList::display() {
  Node* currNode = pList;
  cout << "List contains:" << endl;
  while ( currNode != NULL ) {
    cout << currNode->datum.get() << endl;
    currNode = currNode->next;
  }
}

//----------------------------------------------------
// FUNCTION useClass : client code to exercise Lis