stoneharry

Untitled

Nov 11th, 2012
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void HandleNameInput(int n)
  2. {
  3.     char FirstName[50];
  4.     char LastName[50];
  5.     int i = 0;
  6.     int done = 0;
  7.  
  8.     printf("Please input your first and last names seperated by a space.\n\n");
  9.  
  10.     scanf("%s%s", &FirstName, &LastName);
  11.  
  12.     for (i = 0; i < 100; i++)
  13.     {
  14.         if (FirstName[i] != NULL && done == 0)
  15.         {
  16.             GuestNames[i][n] = FirstName[i];
  17.         }
  18.         else if (done == 0)
  19.         {
  20.             GuestNames[i][n] = ' ';
  21.             done = i;
  22.         }
  23.         else
  24.         {
  25.             if (LastName[i] != NULL)
  26.             {
  27.                 GuestNames[i][n] = LastName[(i-1)-done];
  28.             }
  29.         }
  30.     }
  31.  
  32.     printf("\nYour name has been successfully saved. Thank you.\n\n");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment