home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / tyc / list10_7.c < prev    next >
C/C++ Source or Header  |  1993-10-16  |  505b  |  23 lines

  1.  /* Demonstrates using scanf() to input numeric and text data. */
  2.  
  3.  #include <stdio.h>
  4.  
  5.  char lname[81], fname[81];
  6.  int count, id_num;
  7.  
  8.  main()
  9.  {
  10.      /* Prompt the user. */
  11.  
  12.      puts("Enter last name, first name, ID number separated");
  13.      puts("by spaces, then press Enter.");
  14.  
  15.      /* Input the three data items. */
  16.  
  17.      count = scanf("%s%s%d", lname, fname, &id_num);
  18.  
  19.      /* Display the data. */
  20.  
  21.      printf("%d items entered: %s %s %d", count, fname, lname, id_num);
  22.  }
  23.