home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / R_LA4_01.ZIP / TWINS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1987-12-21  |  988 b   |  33 lines

  1. /****************************************************************/
  2. /* TWINS.C - From page 296 of the book "Microsoft C Program-    */
  3. /* ming for the IBM by Robert Lafore. This is a continuation of */
  4. /* a simple database program developed from page 292 to         */
  5. /* the end of the chapter (9).                                  */
  6. /****************************************************************/
  7.  
  8. main()
  9. {
  10. struct personnel {
  11.    char name [30];
  12.    int agnumb;
  13. };
  14.  
  15. struct personnel agent1;
  16. struct personnel agent2;
  17.  
  18.    printf("\nAgent 1.\nEnter name: ");
  19.    gets(agent1.name);
  20.    printf("Enter agent number (3 digits): ");
  21.    scanf("%d", &agent1.agnumb);
  22.  
  23.    agent2 = agent1;           /*assigns one structure to another*/
  24.  
  25.    printf("\nList of agents:\n\n");
  26.    printf("   Name: %s\n", agent1.name);
  27.    printf("   Agent number: %03d\n", agent1.agnumb);
  28.    printf("   Name: %s\n", agent2.name);
  29.    printf("   Agent number: %03d\n", agent2.agnumb);
  30. }
  31.  
  32.  
  33.