Kamis, 14 April 2016

7.5

Program procedur minimum
#include <iostream>
#include <conio.h>
using namespace std;
class Sorting {
friend istream& operator>>(istream& in, Sorting& a);
friend ostream& operator<<(ostream& out, Sorting& a);
public:
void baca_data();
void cetak_data();
void buble_sort();
void insertion_sort();
void selection_sort();
private:
void minimum(int , int, int&);
void tukar (int&, int&);
int data[10], n;
};
istream& operator>>(istream& in, Sorting& a) {
cout << "Banyak data : ";
in >> a.n;
for (int i = 0; i < a.n; i++) {
cout << "Data ke-" << i+1 << " : ";
in >> a.data[i];
}
return in;
}
ostream& operator<<(ostream& out, Sorting& a) {
for (int i = 0; i < a.n; i++)
out << a.data[i] << " ";
out << "\n";
return out;
}

Tidak ada komentar:

Posting Komentar

Refleksi minggu ke 2

Refleksi Pertemuan ke 2 Assalamu'alaikum w. wb., Selamat berjumpa lagi teman-teman, baik saya disini akan menuliskan tentang refl...