Kaskus

Tech

User telah dihapusAvatar border
TS
User telah dihapus
masalah fungsi di c++ untuk hapus data array yg sama
gan, ane buat fungsi untuk hapus data array yg sama kok malah error kya gini
masalah fungsi di c++ untuk hapus data array yg sama
ini codenya : [url]http://S E N S O R/k2ZPfstk[/url]
ato ane copy di sini aja
Code:
#include <iostream>
using namespace std;
void hapusygsama(double a[int x]){
int jum[x], index[x];
for(int z=0; z<x; z++){
jum[z]=0;
for(int c=0; c<x; c++){
if(a[c]==a[z]){
jum[z]++;
index[z]=c;
}
}
}
for(int z=0; z<x; z++){
if(z==index[z]){
cout<<a[z]<<endl;
}
}
}
int main(){
int n,x;
cin>>n;
double a[n];
for(x=0; x<n; x++){
cin>>a[x];
}
hapusygsama(a[x]);
return 0;
}

pas fungsinya ane ganti jdi gini
Code:
void hapusygsama(double a[], int x){
...
}

juga error gan, kya gini
Code:
21 E:\RieqyNS13\C++\hapusygsama.cpp:27 cannot convert 'double' to 'double*' for argument '1' to 'void hapusygsama(double*, int)'

yg salah apa ya gan, tolong dikoreksi
Diubah oleh User telah dihapus 06-07-2013 13:57
0
4K
4
GuestAvatar border
Komentar yang asik ya
Mari bergabung, dapatkan informasi dan teman baru!
Programmer Forum
Programmer Forum
KASKUS Official
20.2KThread4.9KAnggota
Urutkan
Terlama
GuestAvatar border
Komentar yang asik ya
Ikuti KASKUS di
© 2025 KASKUS, PT Darta Media Indonesia. All rights reserved.