Advertisement
Guest User

main.cpp

a guest
Oct 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. //#pragma warning(disable:4996)
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4. #include<iostream>
  5. #include<time.h>
  6.  
  7.  
  8. #include <fstream>
  9.  
  10. //#include "AVL_test.h"
  11. #include"AVL.h"
  12.  
  13. using namespace std;
  14.  
  15. int main()
  16. {
  17. int key;
  18. char option;
  19.  
  20. NodeAVL *root = NULL;
  21.  
  22. //FILE *fp = fopen ( "input.txt", "r" );
  23. ifstream f("input.txt");
  24.  
  25.  
  26. while(f>>option)
  27. {
  28.  
  29.  
  30. if( option == 'I' )
  31. {
  32. f >> key;
  33. root = insertAVLNode(root, root, key );
  34. }
  35. else if( option == 'D' )
  36. {
  37. f >> key;
  38. root = deleteAVLNode(root, root, key );
  39. }
  40.  
  41. }
  42.  
  43. f.close();
  44.  
  45. displayAVLTree(root,10);
  46.  
  47. system("PAUSE");
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement