From e9b55e37e7f7d675d0d1e5d2bd017440d4eaadc6 Mon Sep 17 00:00:00 2001 From: soulo47 Date: Mon, 30 Jan 2017 11:28:43 -0400 Subject: [PATCH 01/15] Added header file --- Anime.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Anime.h diff --git a/Anime.h b/Anime.h new file mode 100644 index 0000000..c526d7c --- /dev/null +++ b/Anime.h @@ -0,0 +1,31 @@ +#ifndef ANIME_H +#define ANIME_H + +#include +#include + +using namespace std; + + +class Anime +{//class + private: + std::string animegenre; + int numofanime; + + public: + Anime(string="", int=0); + + void set_anime_genre(string genre); + + void set_anime_num(int num); + + + std::string get_anime_genre(); + + int get_anime_num(); + +};//class + +#endif + From dbafb7588f0536d043901d858eb64cea9b94c6f5 Mon Sep 17 00:00:00 2001 From: soulo47 Date: Mon, 30 Jan 2017 11:37:40 -0400 Subject: [PATCH 02/15] Added implementation file --- AnimeImplementation.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 AnimeImplementation.cpp diff --git a/AnimeImplementation.cpp b/AnimeImplementation.cpp new file mode 100644 index 0000000..bf791a1 --- /dev/null +++ b/AnimeImplementation.cpp @@ -0,0 +1,34 @@ +#include +#include + +#include"Anime.h" + +using namespace std; + +Anime::Anime(string genre, int num) +{ + std::string animegenre; + int numofanime; +} + +void Anime::set_anime_genre(std::string genre) +{ + animegenre=genre; +} + +void Anime::set_anime_num(int num) +{ + numofanime=num; +} + +std::string Anime::get_anime_genre() +{ + return animegenre; +} + +int Anime::get_anime_num() +{ + return numofanime; +} + + From c937879796b5a1666d13fa1c6de363847da442ac Mon Sep 17 00:00:00 2001 From: soulo47 Date: Mon, 30 Jan 2017 11:51:49 -0400 Subject: [PATCH 03/15] Added driver file --- AnimeDriver.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 AnimeDriver.cpp diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp new file mode 100644 index 0000000..94745fa --- /dev/null +++ b/AnimeDriver.cpp @@ -0,0 +1,44 @@ +#include +#include +#include + +#include"Anime.h" + +using namespace std; + +int main() +{//main + + string genre; + int num; + + vectoranimestore; + Anime lookup; + + + for(int x=0;x<4;x++) + {//first for + cout << "Please enter the genre of anime you would like to look up." << endl; + cin >> genre; + lookup.set_anime_genre(genre); + + + cout << "Please enter the number of anime you want to look up from this genre." << endl; + cin >> num; + lookup.set_anime_num(num); + + + animestore.push_back(lookup); + + }//first for + + for(int x=0;x<4;x++) + {//second for + cout << "The anime genre and number of anime you would like to look up." << endl; + + cout << animestore[x].get_anime_genre() << " :- " << animestore[x].get_anime_num() << endl; + }//second for + +return 0; + +}//main From 503d27a055ae8b6d20fb569cedde897eeb627bb2 Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:01:12 -0400 Subject: [PATCH 04/15] AnimeDriver.cpp --- AnimeDriver.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index 94745fa..ad944d8 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -6,11 +6,24 @@ using namespace std; +int linearSearch(auto data, auto key) +{ + for(int x=0; x < data.size(); x++) + { + if(data[x].get_anime_num==key) + { + return x; + } + } + return -1; +} + int main() {//main string genre; int num; + int search_key; vectoranimestore; Anime lookup; @@ -31,13 +44,18 @@ int main() animestore.push_back(lookup); }//first for + + cout >> "Please enter a value (integer) to be searched."; + cin << search_key; + + cout >> linearSearch(animestore,search_key); - for(int x=0;x<4;x++) + /*for(int x=0;x<4;x++) {//second for cout << "The anime genre and number of anime you would like to look up." << endl; cout << animestore[x].get_anime_genre() << " :- " << animestore[x].get_anime_num() << endl; - }//second for + }//second for*/ return 0; From 5defee5ba3bec9e313a8503faedbf082c3be868f Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:03:30 -0400 Subject: [PATCH 05/15] AnimeDriver.cpp --- AnimeDriver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index ad944d8..af65bf5 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -10,7 +10,7 @@ int linearSearch(auto data, auto key) { for(int x=0; x < data.size(); x++) { - if(data[x].get_anime_num==key) + if(data.get_anime_num==key) { return x; } From 451ed96f02dc61ca3fb429931e05bd6e44fbd92d Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:14:57 -0400 Subject: [PATCH 06/15] AnimeDriver.cpp --- AnimeDriver.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index af65bf5..cbc2ccd 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -10,7 +10,7 @@ int linearSearch(auto data, auto key) { for(int x=0; x < data.size(); x++) { - if(data.get_anime_num==key) + if(data[x].get_anime_num()==key) { return x; } @@ -45,6 +45,7 @@ int main() }//first for + //search cout >> "Please enter a value (integer) to be searched."; cin << search_key; From eae5e34d252e35be6ecb0fa8ccbdd197ec470d57 Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:22:41 -0400 Subject: [PATCH 07/15] AnimeDriver.cpp --- AnimeDriver.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index cbc2ccd..7c379aa 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -10,7 +10,7 @@ int linearSearch(auto data, auto key) { for(int x=0; x < data.size(); x++) { - if(data[x].get_anime_num()==key) + if(data[x].get_anime_genre()==key) { return x; } @@ -23,7 +23,8 @@ int main() string genre; int num; - int search_key; + string search_key; + int result; vectoranimestore; Anime lookup; @@ -46,10 +47,14 @@ int main() }//first for //search - cout >> "Please enter a value (integer) to be searched."; - cin << search_key; + cout << "Please enter a value (integer) to be searched."; + cin >> search_key; + + + cout >> linearSearch(animestore,search_key); + + - cout >> linearSearch(animestore,search_key); /*for(int x=0;x<4;x++) {//second for From 38aec58ae74e2eb7c711e7df6d99f823d36522cc Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:24:10 -0400 Subject: [PATCH 08/15] AnimeDriver.cpp --- AnimeDriver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index 7c379aa..e99b068 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -10,7 +10,7 @@ int linearSearch(auto data, auto key) { for(int x=0; x < data.size(); x++) { - if(data[x].get_anime_genre()==key) + if(data[x].get_anime_num()==key) { return x; } @@ -23,7 +23,7 @@ int main() string genre; int num; - string search_key; + int search_key; int result; vectoranimestore; From 3acc91f1dfeac613fd3d95895273a19badb6b6d8 Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:29:50 -0400 Subject: [PATCH 09/15] AnimeDriver.cpp --- AnimeDriver.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index e99b068..9171fbf 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -10,7 +10,7 @@ int linearSearch(auto data, auto key) { for(int x=0; x < data.size(); x++) { - if(data[x].get_anime_num()==key) + if(data[x].get_anime_genre()==key) { return x; } @@ -23,7 +23,7 @@ int main() string genre; int num; - int search_key; + string search_key; int result; vectoranimestore; @@ -50,8 +50,25 @@ int main() cout << "Please enter a value (integer) to be searched."; cin >> search_key; + while(input != "#") + { + result = linearSearch (animestore,search_key); + + + cout << search_key << "was "; + + if (result == -1) + cout<<"not found."; + + else + cout<<"found at index "<>search_key; + } - cout >> linearSearch(animestore,search_key); + From fa7033f8877a21d67d0c6f426cd31931ad7dbd6b Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:30:30 -0400 Subject: [PATCH 10/15] AnimeDriver.cpp --- AnimeDriver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index 9171fbf..f7c2b2a 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -50,7 +50,7 @@ int main() cout << "Please enter a value (integer) to be searched."; cin >> search_key; - while(input != "#") + while(search_key != "#") { result = linearSearch (animestore,search_key); From 27317b76d41273fba65bfc667d39cb2e49b32eef Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:37:25 -0400 Subject: [PATCH 11/15] AnimeDriver.cpp --- AnimeDriver.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index f7c2b2a..0fbe8ff 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -10,7 +10,7 @@ int linearSearch(auto data, auto key) { for(int x=0; x < data.size(); x++) { - if(data[x].get_anime_genre()==key) + if(data[x].get_anime_num()==key) { return x; } @@ -23,7 +23,7 @@ int main() string genre; int num; - string search_key; + int search_key; int result; vectoranimestore; @@ -58,27 +58,22 @@ int main() cout << search_key << "was "; if (result == -1) - cout<<"not found."; + cout<<" not found."; else - cout<<"found at index "<>search_key; - } + }//search - - - - - - /*for(int x=0;x<4;x++) + for(int x=0;x<4;x++) {//second for cout << "The anime genre and number of anime you would like to look up." << endl; cout << animestore[x].get_anime_genre() << " :- " << animestore[x].get_anime_num() << endl; - }//second for*/ + }//second for return 0; From b4657381d09cd0e1cf565231f025aef7b704de60 Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:38:46 -0400 Subject: [PATCH 12/15] AnimeDriver.cpp --- AnimeDriver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index 0fbe8ff..f16c194 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -10,7 +10,7 @@ int linearSearch(auto data, auto key) { for(int x=0; x < data.size(); x++) { - if(data[x].get_anime_num()==key) + if(data[x].get_anime_genre()==key) { return x; } @@ -23,7 +23,7 @@ int main() string genre; int num; - int search_key; + string search_key; int result; vectoranimestore; @@ -47,7 +47,7 @@ int main() }//first for //search - cout << "Please enter a value (integer) to be searched."; + cout << "Please enter a value (genre) to be searched."; cin >> search_key; while(search_key != "#") From b11fd89868335e7a2bb16c359024227738db717f Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:41:01 -0400 Subject: [PATCH 13/15] AnimeDriver.cpp --- AnimeDriver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index f16c194..65617dc 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -55,25 +55,25 @@ int main() result = linearSearch (animestore,search_key); - cout << search_key << "was "; + cout " " << search_key << " was "; if (result == -1) cout<<" not found."; else - cout<<" found at index "<>search_key; }//search - for(int x=0;x<4;x++) + /*for(int x=0;x<4;x++) {//second for cout << "The anime genre and number of anime you would like to look up." << endl; cout << animestore[x].get_anime_genre() << " :- " << animestore[x].get_anime_num() << endl; - }//second for + }//second for*/ return 0; From b38e45719ea698e5b9dc3f171cc74aef8e2a1099 Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:41:46 -0400 Subject: [PATCH 14/15] AnimeDriver.cpp --- AnimeDriver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index 65617dc..0bec7fc 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -55,7 +55,7 @@ int main() result = linearSearch (animestore,search_key); - cout " " << search_key << " was "; + cout << " " << search_key << " was "; if (result == -1) cout<<" not found."; From 7d0f8fc3c7fb03496637ec63122cae784cad9a38 Mon Sep 17 00:00:00 2001 From: soulo47 Date: Sat, 11 Feb 2017 12:42:38 -0400 Subject: [PATCH 15/15] AnimeDriver.cpp --- AnimeDriver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp index 0bec7fc..7e4fee7 100644 --- a/AnimeDriver.cpp +++ b/AnimeDriver.cpp @@ -55,7 +55,7 @@ int main() result = linearSearch (animestore,search_key); - cout << " " << search_key << " was "; + cout << " " << search_key << " was"; if (result == -1) cout<<" not found.";