Why is the value of price fixed in C++ structures?

  c++, structure

I have a question regarding structures in C++, why the price value is fixed for all the models although I made it + 200 ?

#include <iostream>

using namespace std;

struct mobilephone {
    string pModel[10];
    int price;
};

int main()
{
    mobilephone apple, blackberry, samsung;
    mobilephone* ptr1, * ptr2, * ptr3;

    ptr1 = &apple;
    ptr2 = &blackberry;
    ptr3 = &samsung;

    ptr1->price = 200;

    cout << "Apple: " << endl;
    for (int i = 0; i < 10; i++) {
        cout << "iphone " << i+4 << ptr1->pModel[i];
        cout << ", price " <<ptr1-> price + 200 <<endl;
    }
}

Source: Windows Questions C++

LEAVE A COMMENT