Assalamualaikum
apa khabar men-teman ?

gini nih, saya lagi belajar c++
waktu saya coba ngompile source code berikut : 

      1 #include <iostream>
      2
      3 using namespace std;
      4
      5 enum JENIS_KELAMIN { Pria, Wanita };
      6 int main() {
      7
      8   struct SISWA {
      9     char NIS[8];
     10     char Nama[20];
     11     JENIS_KELAMIN gender;
     12   } A;
     13
     14   A.NIS = "D0D98021";
     15   A.Nama = "Arista";
     16   A.gender = Wanita;
     17
     18   cout<<"NIS    : "<<A.NIS<<endl;
     19   cout<<"Nama   : "<<A.Nama<<endl;
     20   cout<<"Gender : "<<A.gender<<endl;
     21
     22   return 0;
     23 }


kok ada error spt berikut yak?

# g++ test.cpp -o test
test.cpp: In function `int main()':
test.cpp:14: incompatible types in assignment of `const char[9]' to `char[8]'
test.cpp:15: incompatible types in assignment of `const char[7]' to `char[20]'


saya ngompile make 

 # g++ --version
g++ (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


padahal syntaxnya udah sesuai referensi
mohon pencerahan.



salam,

yanu

-- 
Berhenti langganan: [EMAIL PROTECTED]
Arsip dan info: http://linux.or.id/milis

Kirim email ke