
kod bloğu :
#include <iostream>
#include <string>
using namespace std;
class Store
{
private:
int id;
string name;
string manufact;
int quantity;
string type;

public:
Store() // constructor for class
{
id =1;
name = “Toshiba satallite series notebook”;
manufact = “Toshiba”;
quantity = 5;
type =”Notebook”;
}
void setId(int no)
{
id= no;
}
void setName (string c_name)
{
name = c_name;
}
void setManufact(string manu)
{
manufact = manu;
}
void setQuan(int qua)
{
quantity = qua;
}
void setType(string typ)
{
type = typ;
}
void display()
{
cout<<”———–Welcome to the MgK e-Shop—————”<<endl;
cout<<”Id : “<<id<<endl;
cout<<”Name : “<<name<<endl;
cout<<”Manufacturer : “<<manufact<<endl;
cout<<”Quantity : “<<quantity<<endl;
cout<<”Type : “<<type<<endl<<endl;
}
};
void main()
{
Store myStore; //defining object from class
myStore.display(); // calling default values.
string name;
string manufact;
string type;
int id;
int quantity;
cout<<”Enter product name : “<<endl;
cin>>name;
cout<<”Enter a id of “<<name<<” : “<<endl;
cin>>id;
cout<<”Enter manufacturer name : “<<endl;
cin>>manufact;
cout<<”Enter quantity of product : “<<endl;
cin>>quantity;
cout<<”Enter the type of product : “<<endl;
cin>>type;
myStore.setId(id);
myStore.setManufact(manufact);
myStore.setName(name);
myStore.setQuan(quantity);
myStore.setType(type);
cout<<”\n Updated …”<<endl;
myStore.display();
}
Kaynak kod (cpp) : burdan indirebilirsiniz.

Kod bloğu :
#include< stdio.h>
#include< conio.h>
#include< process.h>
#include< math.h>