//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 7 SORTING//Nama : Muhammad Zuhri //NIM : 2016140614 //Kelas : 04TPLP011 //Tugas Akhir Struktur Data Pertemuan 7.cpp #include <iostream> #include <conio.h> #include <stdio.h&g… Read More
Tugas Akhir Pertemuan 4 POINTER//Nama : Muhammad Zuhri //NIM : 2016140614 //Kelas : 04TPLP011 //Tugas Akhir Struktur Data Pertemuan 4.cpp #include <iostream> #include <conio.h> #include <windows.h… 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 3 STRUCTURE//Nama : Muhammad Zuhri //NIM : 2016140614 //Kelas : 04TPLP011 //Tugas Akhir Struktur Data Pertemuan 3.cpp #include <iostream> #include <conio.h> #include <stdio.h&g… Read More
Tugas Akhir Pertemuan 5 FUNCTION//Nama : Muhammad Zuhri //NIM : 2016140614 //Kelas : 04TPLP011 //Tugas Akhir Struktur Data Pertemuan 5.cpp #include <iostream> #include <conio.h> #include <stdio.h&g… Read More
matur suwun gan
BalasHapus