Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 11th November 2011
Braincode's Avatar
Braincode Braincode is offline
Ceriwis Addicted
 
Join Date: Nov 2011
Posts: 4,638
Rep Power: 20
Braincode mempunyai hidup yang Normal
Default [HELP] Bisa tolong ini salah nya knp...

Agan-agan programer sekalian...

Bisa tolongin saya g gan...

Saya bener2 stuck nih...knp salahnya...

Maap nih banyak permintaan...

Maklum masih newbie...

And makasih sebelumnya...



Source Code nya...



#include

#include



void shellsort(int a[],int n)

{

int j,i,k,m,mid;

for(m = n/2;m>0;m/=2)

{

for(j = m;j< n;j++)

{

for(i=j-m;i>=0;i-=m)

{

if(a[i+m]>=a[i])

break;

else

{

mid = a[i];

a[i] = a[i+m];

a[i+m] = mid;

}

}

}

}

}



main()

{

int a[10],i,n;

clrscr();



printf("Enter The number Of Elements\t: ");

scanf("%d",&n);

for(i=0;i< n;i++)

{

printf("\nElement %d\t: ",i+1);

scanf("%d",&a[i]);

}



printf("\nArray Befor Sorting : ");

for(i=0;i< n;i++)

printf("%5d",a[i]);

shellsort(a,n);



printf("\nArray After Sorting : ");

for(i=0;i< n;i++)

printf("%5d",a[i]);

getch();

return 0;

}



/* OUTPUT







Erornya tuh ini pas di compile...





C:\Users\TOSHIBA\Downloads\Documents\Struktur Data\Shell Sort\coba3\coba3.cpp In function `int main()':

29 C:\Users\TOSHIBA\Downloads\Documents\Struktur Data\Shell Sort\coba3\coba3.cpp `clrscr' undeclared (first use this function)

(Each undeclared identifier is reported only once for each function it appears in.)



51:1 C:\Users\TOSHIBA\Downloads\Documents\Struktur Data\Shell Sort\coba3\coba3.cpp unterminated comment

C:\Users\TOSHIBA\Downloads\Documents\Struktur Data\Shell Sort\coba3\Makefile.win [Build Error] [coba3.o] Error 1



Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 08:13 PM.


no new posts