Advertisement
ahmad_zizo

main_delete

May 31st, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. /*char z2[15];
  2. system("cls");
  3. printf("1- by name\n2- by id\n");
  4. printf("your choice: ");
  5. scanf(" %[^\n]s",z2);
  6. int x2=atoi(z2);
  7. if(x2==1)
  8. {
  9. system("cls");
  10. printf("Enter name: ");
  11. while((c= getchar()) != '\n' && c != EOF);
  12. gets(name);
  13. node_id* temp = search_name(&root_name, name);
  14. if (temp != NULL)
  15. {
  16. id = temp->id;
  17. }
  18. if(temp == NULL)
  19. printf("NOT FOUND.\n\n");
  20. else
  21. {
  22. root_id = delete_id(root_id, id);
  23. root_name = delete_name(root_name, name);
  24. printf("\n%d %s has been deleted succesfuly.\n\n",id,name);
  25. }
  26. }
  27.  
  28. else if(x2==2)
  29. {
  30. system("cls");
  31. printf("Enter id: ");
  32. scanf("%d", &id);
  33. node_id* temp = search_id(&root_id, id);
  34. if (temp != NULL)
  35. {
  36. strcpy(name, temp->name);
  37. }
  38. if(temp==NULL)
  39. printf("NOT FOUND.\n\n");
  40. else
  41. {
  42. root_id = delete_id(root_id, id);
  43. root_name = delete_name(root_name,name);
  44. printf("\n%d %s has been deleted succesfuly.\n\n",id,name);
  45. }
  46. }
  47. else
  48. {
  49. system("cls");
  50. printf("enter a valid choice.\n");
  51. break;
  52. }
  53. break;*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement