Labels

Sabtu, 25 Februari 2012

contoh customer C++

1. Simpan code berikut dengan nama customer.h
#include<string>
#include<iostream>
using namespace std;

enum c_kind {general, wholesale, retail};

class customer{
public:
void set_id(int id){
id_number=id;
cout<< "id number : "<<(id)<<endl;
}

void set_name(const string& last, const string& first){
last_name= last;
first_name= first;
}

c_kind get_kind() const{
return t;
}

void set_kind(c_kind k){
t=k;
}

void print() const{
cout<< (first_name+" "+last_name)<<endl;
}

double price_discount() const;

private:
string last_name, first_name;
int id_number;
c_kind t;
};

2. Simpan kode di bawah dengan nama customer.cpp

//customer.cpp
#include "customer.h"
double customer::price_discount() const{
if(t==wholesale)
return 0.20;
else
return 0.1;
}

3. Simpan kode terakhir berikut dengan nama democustomer.cpp

//democustomer.cpp
#include<iostream>
#include "customer.h"
using namespace std;

int main(){
customer c;
c.set_name("taufik","abidin");
c.set_kind(retail);
c.print();
c.set_id(2);
cout<< "your PC costs: $"<< 900*(1-c.price_discount())<<endl;
}

4. Kompile program dengan cara


c++ -Wall -o demo democustomer.cpp customer.cpp

Merubah tampilan icon blogspot pada bar addres












ok,, pada pertemuan kali ini,, saatnya mempelajari cara mengubah icon blogspot pada addres bar,,

1. buka blog anda atau dasbor lalu menuju Rancangan -> Edit HTML
2. cari coding </head>
3. paste coding di bawah ini tepat di antara </head> dan <body>..
<link href='http://icons.iconator.com/176/ICONATOR_1c4f6d303df353559c208fa032b6d2e8.gif' rel='SHORTCUT ICON'/>

4. Tulisan yang berwarna merah dapat anda ganti dengan icon yg anda ingin kan.