home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / info / c_tutorg / open.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-24  |  693 b   |  34 lines

  1.                                      // Chapter 5 - Program 1
  2. #include <iostream.h>
  3.  
  4. struct one_datum @{
  5.    int data_store;
  6. @};
  7.  
  8. main()
  9. @{
  10. one_datum dog1, dog2, dog3;
  11. int piggy;
  12.  
  13.    dog1.data_store = 12;
  14.    dog2.data_store = 17;
  15.    dog3.data_store = -13;
  16.    piggy = 123;
  17.  
  18.    cout << "The value of dog1 is " << dog1.data_store << "\n";
  19.    cout << "The value of dog2 is " << dog2.data_store << "\n";
  20.    cout << "The value of dog3 is " << dog3.data_store << "\n";
  21.    cout << "The value of piggy is " << piggy << "\n";
  22. @}
  23.  
  24.  
  25.  
  26.  
  27. // Result of execution
  28. //
  29. // The value of dog1 is 12
  30. // The value of dog2 is 17
  31. // The value of dog3 is -13
  32. // The value of piggy is 123
  33.  
  34.