//Nama : Muhammad Zuhri
//NIM : 2016140614
//Kelas : 04TPLP011
//Tugas Akhir Struktur Data Pertemuan 9.cpp
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
using namespace std;
int sort_function(const void *a, const void *b);
char list[8][9]={"aku","suka","sama","kamu","dari","dulu","sampai","sekarang"};
int main(void)
{
int x,y;
cout<<"Nama : namamu\nNIM : nimmu\nKelas : kelasmu\n\n";
printf("\t\t**Susun Kata**\n\n");
printf("Kata Sebelum di Susun : \n");
for(y=0;y<8;y++)
printf("%s ",list[y]);
printf("\n\nKata Setelah di Susun : \n");
qsort((void *)list, 8, sizeof(list[0]), sort_function);
for(x=0;x<8;x++)
printf("%s\n",list[x]);
return 0;
}
int sort_function(const void *a, const void *b)
{
return (strcmp((char *)a, (char *)b));
}
Hasil Outputnya seperti gambar dibawah ini :
Semoga materi struktur data ini bermanfaat bagi teman-teman yang membutuhkannya :)
Jumat, 01 Juni 2018
Home »
» Tugas Akhir Pertemuan 9 SORTING (Lanjut 2)
Tugas Akhir Pertemuan 9 SORTING (Lanjut 2)
Related Posts:
Tugas Akhir Pertemuan 6 SEARCHING//Nama : Muhammad Zuhri //NIM : 2016140614 //Kelas : 04TPLP011 //Tugas Akhir Struktur Data Pertemuan 6.cpp #include <iostream> #include <conio.h> using namespace std; m… Read More
Tugas Akhir Pertemuan 8 SORTING (Lanjut 1)//Nama : Muhammad Zuhri //NIM : 2016140614 //Kelas : 04TPLP011 //Tugas Akhir Struktur Data Pertemuan 8.cpp #include <iostream> #include <stdio.h> #include <conio.h&g… Read More
Tugas Akhir Pertemuan 10 LINKED LIST//Nama : Muhammad Zuhri //NIM : 2016140614 //Kelas : 04TPLP011 //Tugas Akhir Struktur Data Pertemuan 10.cpp #include<iostream> #include<cstdlib> using namespace std; … Read More
Tugas Akhir Pertemuan 9 SORTING (Lanjut 2)//Nama : Muhammad Zuhri //NIM : 2016140614 //Kelas : 04TPLP011 //Tugas Akhir Struktur Data Pertemuan 9.cpp #include<stdio.h> #include<stdlib.h> #include<string.h>… Read More
Tugas Akhir Pertemuan 11 STACK//Nama : Muhammad Zuhri //NIM : 2016140614 //Kelas : 04TPLP011 //Tugas Akhir Struktur Data Pertemuan 11.cpp #include<stdio.h> #include<conio.h> int MAXSTACK; typedef i… Read More
matur suwun gan
BalasHapus