Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <iostream>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <time.h>
#include <vector>
#include "Stats.h"
#include "activities.h"
#include "EggHatch.h"
#include "AnimalStates.h"
using namespace std;
int main()
{
string usertype = egghatching();
cout<< "What would you like to name this creature?" << endl;
string name;
cin >> name;
if(usertype == "Cat")
{
Cat e(name);
e.normal();
cout << "\n" << e.getHappy() << endl;
cout<< "Congratulations, you are now a parent" << endl;
system("pause");
}
if(usertype == "Dog")
{
Dog e(name);
e.normal();
cout << "\n" << e.getHappy() << endl;
cout<< "Congratulations, you are now a parent" << endl;
system("pause");
}
//string name1;
// vector<string> names;
// srand(time(0));
// ifstream file("names.txt");
// while(getline(file,name1)){
// names.push_back(name1);
// }
// int total_names = names.size()-1;
// // /
// int random_number = rand()%total_names;
// string name = names[random_number];
// cout << "Hello i am, " << name << endl;
// system("pause");
Stats firstPet(name, usertype);
while (true)
{
vector<string> menu = {"Food", "Shop", "Games", "sleep", "Stats", "Save", "Load", "Exit"};
string output = Display(menu);
if (output == "Food")
{
Food(firstPet);
}
else if (output == "Shop")
{
Shop(firstPet);
}
else if (output == "Games")
{
Games(firstPet);
}
else if (output == "Sleep")
{
firstPet.Sleep();
}
else if (output == "Stats")
{
firstPet.displayStats();
}
else if (output == "Save")
{
firstPet.Save();
}
else if (output == "Load")
{
firstPet.getSave();
}
else if (output == "Exit")
{
cout << "Goodbye! See you soon!" << endl;
break;
}
}
return 0;
}