hai sobat ketemu lagi di refleksi Magic of Lecturer:
Pada pertemuan ini membahas tentang ENTITAS, VARIAN RELASI, KARDINALITAS
-
ENTITAS
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
inilah program untuk mencari jarak 2 titik dengan menggunakan class titik.
comment ya kalo ada perbaiakan
#include <cstdlib>
#include <iostream>
using namespace std;
class Titik{
private :
double x, y;
public :
Titik();
Titik(double i, double j);
double jarak(Titik a, Titik b);
};
Titik::Titik(){}
Titik::Titik(double i, double j){
x=i;
y=j;
}
double Titik::jarak(Titik a, Titik b){
double panjang;
panjang = sqrt(((b.x-a.x)*(b.x-a.x))+((b.y-a.y)*(b.y-a.y)));
return panjang;
}
int main(int argc, char *argv[])
{
int n,a,b,x,y;
double jarak_min;
cout<<"Masukkan N titik : ";
cin>>n;
Titik t[n];
Titik pdk;
for(int i=0;i<n;i++){
cout<<"Masukkan koordinat titik ke-"<<i+1<<endl;
cout<<"x : ";
cin>>x;
cout<<"y : ";
cin>>y;
t[i] = Titik(x,y);
}
jarak_min = 1001;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
cout<<"jarak titik "<<i+1<<" ke titik "<<j+1<<" = "<<pdk.jarak(t[i],t[j])<<endl;
if(pdk.jarak(t[i],t[j])<jarak_min){
jarak_min = pdk.jarak(t[i],t[j]);
a = i;
b = j;
}
}
}
cout<<"Dua Titik terpendek adalah sepanjang "<<jarak_min<<endl;
cout<<"Kedua Titik tersebut adalah titik ke - "<<a+1<<" dan Titik ke - "<<b+1<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
rujukan blog : adialamsyah.com
Hai sobat inilah program untuk menghitung
#include <cstdlib>
#include <iostream>
using namespace std;
double pangkat(double x, int y){
double hasil=1;
for(int i=1;i<=y;i++){
hasil=hasil*x;
}
return hasil;
}
unsigned long faktorial(int x){
unsigned long hasil=1;
for(int i=1;i<=x;i++){
hasil=hasil*i;
}
return hasil;
}
Hai kawan-kawan........
inilah sebuah program kecil
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout<<"\t\tProgram menampilkan nilai Max-Min\n\n";
int n, max, min;//deklarasi variabel awal
//input
cout<<"Masukkan banyak data : ";
cin>>n;
cout<<endl;