On Friday 10 October 2003 19:37, aliflammim wrote:
> #include <iostream.h>
> #include <stdio.h>
>
> class nilai
> {
> private:
> int A;
> public:
> int AmbilA(void) {return A = 10;}
> };
>
> char nilai = 'B';
> main(void)
> {
> nilai Huruf;
> printf("Nilai = %c",nilai)
> }
>
> [EMAIL PROTECTED] kuliah]$ g++ hal13b.cc -o hal13b -Wno-deprecated
>
> hal13b.cc: In function `int main()':
> hal13b.cc:15: `nilai' undeclared (first use this function)
class B sudah anda ganti dengan: "char nilai ='B';", sehingga menyebabkan
> hal13b.cc:15: `nilai' undeclared (first use this function)
nilai sudah berubah menjadi variable (bukan class atau type lagi).
> hal13b.cc:15: (Each undeclared identifier is reported only once for each
> function it appears in.)
> hal13b.cc:15: parse error before `;' token
> hal13b.cc:17: parse error before `}' token
kurang ';' di statement printf.
Sebaiknya, anda check dulu code-nya, syntax-errors dapat dideteksi dengan
membaca compiler error message dengan cukup mudah.
Rachman Chavik
--
Berhenti langganan: [EMAIL PROTECTED]
Arsip dan info: http://linux.or.id/milis.php