#include "iostream.h" // tukarkan tanda " kepada < dan > accordingly
class one_datum {
int data_store;
public:
void set(int in_value);
int get_value(void);
};
void one_datum::set(int in_value)
{
data_store = in_value;
}
int one_datum::get_value(void)
{
return data_store;
}
main()
{
one_datum dog1, dog2, dog3;
int piggy;
dog1.set(12);
dog2.set(17);
dog3.set(-13);
piggy = 123;
// dog1.data_store = 115; This is illegal in C++
// dog2.data_store = 211; This is illegal in C++
cout << "The value of dog1 is " << dog1.get_value() << "\n";
cout << "The value of dog2 is " << dog2.get_value() << "\n";
cout << "The value of dog3 is " << dog3.get_value() << "\n";
cout << "The value of piggy is " << piggy << "\n";
}
// Result of execution
//
// The value of dog1 is 12
// The value of dog2 is 17
// The value of dog3 is -13
// The value of piggy is 123
Subscribe dengan Rohaza Dollah dot com untuk mendapat tipstips/produk/idea terkini tentang pernigaaan internet.
Subscribe melalui Email
Subscribe melalui Email
ATAU
Categories
- Affiliate Program (1)
- Ainul Mardhiah (1)
- Articles (1)
- Audio Book (1)
- birthday (1)
- Business (5)
- Cerekarama Online (1)
- Computer Ethic (1)
- Diariku (13)
- dns (1)
- domain (1)
- final countdown (1)
- Health (1)
- Isu Semasa (2)
- Java (2)
- Jokes (2)
- Make Money Online (3)
- Million Challenge (1)
- Motivation (3)
- Pengaturcaraan C++ (10)
- penyakit rohani (1)
- Petua Hebat Blogging (5)
- Politik (1)
- Russell Brunson (1)
- server (1)
- web hosting (1)
- Worth Reading (1)
April 22, 2008
Contoh Aturcara C++
Labels: Pengaturcaraan C++
Subscribe to:
Post Comments (Atom)
Work at Home, Stay at Home
Download PERCUMA
Dapatkan secara percuma beberapa material yang boleh dimuat turun secara PERCUMA.
Pengiklanan Berkesan
Online Success Plan
.....dan banyak lagi akan ditambah dari masa ke semasa.
Pengiklanan Berkesan
Online Success Plan
.....dan banyak lagi akan ditambah dari masa ke semasa.
0 comments:
Post a Comment