associating a character name with a numerical number in an array

I have a range of data which includes a designation name of a herd of cows (char), a number of cows per herd(Double) and a range of paddocks to associate with the herd (double) which may number between 4 to 60 paddocks per herd. I think an array would be best, with a default value of one data range but which is ultimately user defined by the number of herds they have. I would like to know if I can allocate a number (double) to the herds then associate that allocated number to the user defined herd name (Char). If this is possible then the array would work with all elements defined as doubles. Yes this is my first program and I have used this site and code blocks for my help so far. I also have an O'Reilly's pocket reference, Structured Programming with C++ and other sites.
Use structs:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <string>

struct Herd 
{
    std::string name;//I have a dislike for c-style strings
    double cows;//Do you really need double? Will you have 1  and ⅓ cows in your herd?
                //If not, change this to int or unsigned int
    double paddocks;//Same here
};

int main()
{
    Herd data[10];
    Herd temp;
    temp.name = "moo";
    temp.cows = 1.75;
    temp.paddocks = 1;
    data[0] = temp;
    std::cout << data[0].name << std.endl;
}
Thanks for that solution MiiNiPa, Int would will be fine for these elements. I was on this all day and got pretty confused buy the time I posted. I had not thought about structures.

Cheers
Topic archived. No new replies allowed.