home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / tutorial / cpptutor / source / supervsr.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-15  |  1.8 KB  |  79 lines

  1.                              // Chapter 11 - Program 4 - SUPERVSR.CPP
  2. #include "supervsr.h"
  3. #include <iostream.h>
  4. #include <string.h>
  5.  
  6. // In all cases, init_data assigns values to the class variables and
  7. //  display outputs the values to the monitor for inspection.
  8.  
  9. void
  10. supervisor::init_data(char in_name[], int in_salary, char in_title[])
  11. {
  12.    strcpy(name,in_name);
  13.    salary = in_salary;
  14.    strcpy(title, in_title);
  15. }
  16.  
  17.  
  18.  
  19.  
  20. void
  21. supervisor::display(void)
  22. {
  23.    cout << "Supervisor --> " << name << "'s salary is " << salary <<
  24.                                  " and is the " << title << ".\n\n";
  25. }
  26.  
  27.  
  28.  
  29.  
  30. void
  31. programmer::init_data(char in_name[], int in_salary, char in_title[],
  32.                   char in_language[])
  33. {
  34.    strcpy(name,in_name);
  35.    salary = in_salary;
  36.    strcpy(title, in_title);
  37.    strcpy(language, in_language);
  38. }
  39.  
  40.  
  41.  
  42.  
  43. void
  44. programmer::display(void)
  45. {
  46.    cout << "Programmer --> " << name << "'s salary is " << salary <<
  47.                                         " and is " << title << ".\n";
  48.    cout << "               " << name << "'s specialty is " << 
  49.                                                  language << ".\n\n";
  50. }
  51.  
  52.  
  53.  
  54.  
  55. void
  56. secretary::init_data(char in_name[], int in_salary, 
  57.                              char in_shorthand, char in_typing_speed)
  58. {
  59.    strcpy(name,in_name);
  60.    salary = in_salary;
  61.    shorthand = in_shorthand;
  62.    typing_speed = in_typing_speed;
  63. }
  64.  
  65.  
  66.  
  67.  
  68. void
  69. secretary::display(void)
  70. {
  71.    cout << "Secretary ---> " << name << "'s salary is " << salary <<
  72.                                                                ".\n";
  73.    cout << "               " << name << " types " << typing_speed <<
  74.               " per minute and can ";
  75.    if (!shorthand) 
  76.       cout << "not ";
  77.    cout << "take shorthand.\n\n";
  78. }
  79.