Advertisement
ahmad_zizo

Untitled

Dec 25th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. void delete_()
  2. {
  3. int i,n;
  4. for(i=0; i<counter; i++)
  5. printf("%d)first name: %s\nlast name: %s\nAddress: %s\nCity: %s\nNumber: %s\n",i+1,person[i].fname,person[i].lname,person[i].address,person[i].city,person[i].number);
  6. printf("enter the number of contact you want to delete: ");
  7. scanf("%d",&n);
  8. n--;
  9. for(i=n; i<=counter; i++)
  10. {
  11. strcpy(person[i].fname,person[i+1].fname);
  12. strcpy(person[i].lname,person[i+1].lname);
  13. strcpy(person[i].address,person[i+1].address);
  14. strcpy(person[i].city,person[i+1].city);
  15. strcpy(person[i].number,person[i+1].number);
  16. }
  17. counter--;
  18. system("cls");
  19. printf("\nA contact has been deleted.");
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement