#include
class Barang
{
public:
int barang[4],purata;
public:
void bacanilai()
{ int jum=0;
for( int i=0; i<=4; i++)
{
cout<<"Masukkan barang["<< i <<"] nilai barang RM:"<< endl;
cin>>barang[i];
jum+=barang[i];
}
cout<<"jumlah terkini RM:"<< jum << endl;
purata = jum / 5;
}
void paparnilai()
{ cout<<"jumlah harga 5 barang seluruh RM:"<< jum << endl;
cout<<"jumlah purata 5 barang seluruh RM:"<< purata << endl;
}
};
void main()
{ Barang barangA;
barangA.bacanilai();
barangA.paparnilai();
}
Sunday, April 27, 2008
Schema Question 2: Practicaal Test 1
Posted by Hafisdn at Sunday, April 27, 2008 Labels: class
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment