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 + diff --git a/AnimeDriver.cpp b/AnimeDriver.cpp new file mode 100644 index 0000000..7e4fee7 --- /dev/null +++ b/AnimeDriver.cpp @@ -0,0 +1,80 @@ +#include +#include +#include + +#include"Anime.h" + +using namespace std; + +int linearSearch(auto data, auto key) +{ + for(int x=0; x < data.size(); x++) + { + if(data[x].get_anime_genre()==key) + { + return x; + } + } + return -1; +} + +int main() +{//main + + string genre; + int num; + string search_key; + int result; + + 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 + + //search + cout << "Please enter a value (genre) to be searched."; + cin >> search_key; + + while(search_key != "#") + { + result = linearSearch (animestore,search_key); + + + 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++) + {//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 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; +} + +