Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
121 lines (98 sloc) 2.8 KB
//
// main.cpp
// Ideas_Bank
//
// Created by Mirna Wahab on 24/04/2017.
// Copyright © 2017 Mirna Wahab. All rights reserved.
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <stdlib.h>
#include <iomanip>
#include <stdio.h>
using namespace std;
#include "AVL_ADT_d.h"
#include "Idea.h"
#include "IdeasBank.h"
#include "Index.h"
int main(){
IdeasBank ideaBank;
int action;
int ID, id_;
string word;
do
{
cout << "\n Welcome to Ideas Bank\n\n"
<< "Input action to be taken\n"
<< "1: Insert an idea\n"
<< "2: Insert ideas from ideas.txt file\n"
<< "3: Delete an idea\n"
<< "4: Display an idea\n"
<< "5: Display all ideas\n"
<< "6: Display tree\n"
<< "7: Input word query to display relevant ideas\n"
<< "0: Quit\n"
<< endl;
cin.clear();
cin >> action;
switch (action) {
case 0:
cout << "Exiting Ideas Bank.." << endl;
break;
case 1:
cin.ignore();
ideaBank.inputIdea();
ideaBank.indexing();
break;
case 2:
ideaBank.inputIdeasTxt();
ideaBank.indexing();
break;
case 3:
cout << "Enter idea ID to be deleted:" << endl;
cin >> ID;
ideaBank.deleteIdea(ID);
ideaBank.indexing();
break;
case 4:
cout << "Enter idea ID to be displayed:" << endl;
cin >> id_;
ideaBank.displayIdea(id_);
break;
case 5:
ideaBank.displayAllIdeas();
break;
case 6:
ideaBank.printTree();
break;
case 7:
cout << "Enter word query to be displayed:" << endl;
cin >> word;
ideaBank.searchQuery(word);
word = "";
break;
default:
cout << "Invaild action" << endl;
break;
}
}while (action != 0);
/* FOR TESTING
ideaBank.inputIdeasTxt();
ideaBank.indexing();
ideaBank.printTree();
//ideaBank.inputIdea();
ideaBank.inputIdeaTest();
ideaBank.indexing();
ideaBank.printTree();
ideaBank.deleteIdea(370);
ideaBank.printTree();
ideaBank.searchQuery("computer");
cout << "\n\nDisplaying ideas Bank:" << endl;
ideaBank.displayAllIdeas();
*/
return 0;
}
You can’t perform that action at this time.