info@thistimebd.com

Friday 19th of April 10:52:05pm

Write a cpp program which have a product name class and it read product details- c plus plus

Example 1:

#include

#include

using namespace std;

class RAM

{

public:

    string name;

    int Price;

    int Product_code;

    string Brand;



    void set_price(int new_price)

    {

        Price=new_price;

    }

    void name_edit(string new_name)

    {


        name=new_name;

    }

};


int main()

{

    RAM RAM1;

    RAM1.Price=2200;

    RAM1.Product_code=519;

    RAM1.name="ADATA 4GB DDR3 1600 BUS";

    RAM1.Brand="ADATA";

//change ram 1 value

    RAM1.name="ADATA 4GB DDR9 1600 BUS";


    cout<

    cout<

    cout<

    cout<


}


Example 2:-------------------------------------------------------------------->

#include

#include

using namespace std;

class RAM

{

public:

    string name;

    int Price;

    int Product_code;

    string Brand;



    void set_price(int new_price)

    {

        Price=new_price;

    }

    void name_edit(string new_name)

    {


        name=new_name;

    }



};


int main()

{

    RAM RAM1;

    RAM1.Price=2200;

    RAM1.Product_code=519;

    RAM1.name="ADATA 4GB DDR3 1600 BUS";

    RAM1.Brand="ADATA";


    RAM1.name="ADATA 4GB DDR9 1600 BUS";


    cout<

    cout<

    cout<

    cout<

}