A simple client

The following is a a simple client for the types of ADTs we implement in this course.

#include <iostream>
#include <iomanip>
#include <vector>
#include "bsta.cpp"

using namespace std;


int main(int argc, char *argv[]) {

    BSTA<int,64> b;
    string inst; 
    int a;
    bool success;

    while (cin >> inst  and inst != "q") {

      if (inst == "i") {
        cin >> a;
        cout << "Inserting a " << a << ".\n";
        success = b.insert(a);
        cout << "  " << (success ? "Successfull" : "Failed") << " insertion.\n";
      }
      else if (inst == "r") {
        cin >> a;
        cout << "Removing the " << a << ".\n";
        success = b.remove(a);
        cout << "  " << (success ? "Successfull" : "Failed") << " removal.\n";
      }
      else if (inst == "s") {
        cin >> a;
        cout << "Searching for " << a << ".\n";
        success = b.search(a);
        cout << "  " << (success ? "Found" : "Not found") << "\n";
      }
      else if (inst == "d") {
        cout << endl << b << endl;

      }


      else {
        cout << "Not recongnized\n";      
      }    
    }
    return 0;

}