Is there a better design I can use for this code?
I am trying to solve this problem:

We were given two countries namely Brazil and Argentina. Both had one inventory each with 100 ipods in them. The cost of ipod in Brazil was 100/unit and in Argentina it was 50/unit but to get ipods form Argentina u also had to pay 400/10units. Now they give us some number and we had to find out which purchase would be cheaper. 

This is the logic I have used:


    #include<iostream.h>
    #include<string.h>
    #include<stdlib.h>
    #include<conio.h>
    class country
    {
    public:
    int name;
    int items,unit;
    float cost,price;
    
    public:
    country();
    void purchase(std::string,int);
    void setData(int,int,float,float, int);
    };
    country::country()
    {
    }
    void country::setData(int name,int items,float cost,float price,int unit)
    {
    name=name;
    items=items;
    cost=cost;
    price=price;
    unit=unit;
    }
    void country::purchase(std::string a, int b)
    {
    float custCost=0;
    std::cout<<a;
    cout<<"item"<<name;
    if(b<=items)
    {
    items=items-b;
    custCost=cost*b;
    cout<<name<<":"<<items<<":"<< custCost;
    }
    
    }
    int main()
    {
    country t[2];
    t[0].setData(0,100,100,0,0);
    t[1].setData(1,100,50,400,20);
    std::string a;
    int b,con;
    cout<<"enter the country";
    std::cin>>a;
    cout<<"enter the items needed";
    cin>>b;
    if(a=="brazil")
    con=0;
    else con=1;
    t[con].purchase(a,b);
    
    getch();
    return 0;
    }

It works but I am not totally satisfied with my design as I feel it's too cumbersome.
Specially, if I change the price etc., code changes have to be made.

Can somebody please present a better design?




Is there a better design I can use for this code?
===

I am trying to solve this problem:

We were given two countries namely Brazil and Argentina. Both had one inventory each with 100 ipods in them. The cost of ipod in Brazil was 100/unit and in Argentina it was 50/unit but to get ipods form Argentina u also had to pay 400/10units. Now they give us some number and we had to find out which purchase would be cheaper. 

This is the logic I have used:


    #include<iostream.h>
    #include<string.h>
    #include<stdlib.h>
    #include<conio.h>
    class country
    {
    public:
    int name;
    int items,unit;
    float cost,price;
    
    public:
    country();
    void purchase(std::string,int);
    void setData(int,int,float,float, int);
    };
    country::country()
    {
    }
    void country::setData(int name,int items,float cost,float price,int unit)
    {
    name=name;
    items=items;
    cost=cost;
    price=price;
    unit=unit;
    }
    void country::purchase(std::string a, int b)
    {
    float custCost=0;
    std::cout<<a;
    cout<<"item"<<name;
    if(b<=items)
    {
    items=items-b;
    custCost=cost*b;
    cout<<name<<":"<<items<<":"<< custCost;
    }
    
    }
    int main()
    {
    country t[2];
    t[0].setData(0,100,100,0,0);
    t[1].setData(1,100,50,400,20);
    std::string a;
    int b,con;
    cout<<"enter the country";
    std::cin>>a;
    cout<<"enter the items needed";
    cin>>b;
    if(a=="brazil")
    con=0;
    else con=1;
    t[con].purchase(a,b);
    
    getch();
    return 0;
    }

It works but I am not totally satisfied with my design as I feel it's too cumbersome.
Specially, if I change the price etc., code changes have to be made.

Can somebody please present a better design?



