c++ oop Class ve constructor kullanarak display,update Shop örneği

Mehmet Gökhan KÖYLÜ tarafından 29 Nisan 2010 tarihinde yazılmıştır.
Yorum Yok

 

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.

Booth algoritması Çarpma işlemi

Mehmet Gökhan KÖYLÜ tarafından 25 Nisan 2010 tarihinde yazılmıştır.
Yorum Yok

Kod bloğu :

#include< stdio.h>

#include< conio.h>

#include< process.h>

#include< math.h>

Devamını Oku

OKvizyon.Com 2010 © Telif Hakları Saklıdır.
Tema: Popho V2 | Web Tasarım: Seo
Bu site ; Seo Kavramı Üzerine Kuruludur.