Inventories of iPods for different countries
Before looking at your design, a few trivial points that you can correct,

#include&lt;iostream&gt;
#include&lt;string&gt;
#include&lt;cstdlib&gt;



Avoid c style header usage. Instead use the c++ header style, and namespaces.
Instead of conio.h/getch() is not really portable. Avoid it.
Your setData method should really be the constructor. Using setData to populate the structure is a c habit. Also be sure to use the member initializers for construction.


You really want to keep the members private

class country {
  private:
    int name;
    int items,unit;
    float cost,price;

    bool try_purchase(std::string,int);

  public:
    country(int,int,float,float, int);
    void do_purchace(std::string a);
};
country::country(int name,int items,float cost,float price,int unit)
          :name(name),items(items),cost(cost),price(price){}

// false indicates that the purchase failed.
bool country::try_purchase(std::string a, int b) {
  if(b &gt; items) return false;
  items = items - b;
  return true;
}
void country::do_purchace(std::string a) {
  int b;
  std::cout&lt;&lt;"enter the items needed: ";
  std::cin&gt;&gt;b;
  if (try_purchase(a,b)) 
    std::cout&lt;&lt;name&lt;&lt;":"&lt;&lt;items&lt;&lt;":"&lt;&lt;cost * b&lt;&lt;std::endl;
}
int main()
{
  country t[] = {country(0,100,100,0,0), country(1,100,50,400,20)};
  std::string a;
  std::cout&lt;&lt;"enter the country: ";
  std::cin&gt;&gt;a;
  int con = (a=="brazil") ? 0 : 1;
  t[con].do_purchace(a);
}


Avoid incorporating io statements with your logic. Refactor purchase so that logic is separated to another method.

Regarding your assertion that code changes have to be made if you change price, I do not see why. You can read the information to construct a country from a file and thus avoid hard coding it in the main file. However, this does not change the design as a whole.