lundi 24 juillet 2017

cout a struct of names

I am trying to create a horse game where a user inputs his horse's name, then set their horse to 0 for all attributes after which print all the names to include their horse to the screen. Do I need to use a ranged for loop to cout the names after I get the users input?

 enum horseName
{
    Forego, Alysheba, Gypsy, Fella, Sky

};
// struct for horse information 
struct Horse
{
    string HorseNames[7];
    string name[6];
    int distance[100];
    int eventOffSet;
    int horseID[6];
};
// number of horses (6)
const int horseCount = 6;
// length of track (100)
const int lenTrack = 100; 
//--end of global constants---------
//----------------------------------

//**begin main program**************
int main()
{
    using namespace std;

    // seed random number generator
    srand(time(NULL));
    // create and initialize variables
    Horse myHorse;
    // create horses
    vector <Horse> Horses(6);
    string HorseNames[] = { "Forego", "Alysheba", "Gypsy", "Fella", "Sky" };
    char userHorse;
    array <Horse, horseCount> Horses;
    //Show all Horses and have user name horses

    for (auto &k : HorseNames)
    {
        cout << "The Name Of Your Galent Steed Is?: " << endl;
        getline(cin, HorseNames);
        k.distance = 0;
        k.eventOffSet = 0;
        k.horseID = k.horseID++;

        cout << "OUR LINEUP INCLUDES!:\n";
        cout << HorseNames[k] << endl;

    }

Aucun commentaire:

Enregistrer un commentaire