• RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Heading 1 Here:Enter the heading 1 description here.Go to blogger edit html,find these words and replace it with your own description ...
  • Heading 2 Here:Enter the heading 2 description here.Go to blogger edit html,find these words and replace it with your own description ...
  • Heading 3 Here:Enter the heading 3 description here.Go to blogger edit html,find these words and replace it with your own description ...
  • Heading 4 Here:Enter the heading 4 description here.Go to blogger edit html,find these words and replace it with your own description ...
  • Heading 5 Here:Enter the heading 5 description here.Go to blogger edit html,find these words and replace it with your own description ...
  • SLIDE-1-TITLE-HERE

    Welcome to Blogger.Go to Blogger edit html and find these sentences.Now replace these text/sentences with your own descriptions.This theme is convert to Blogger by Premiumbloggertemplates.com.Download this template and more Premium Blogger Templates From PremiumBloggerTemplates.com...

  • SLIDE-2-TITLE-HERE

    Welcome to Blogger.Go to Blogger edit html and find these sentences.Now replace these text/sentences with your own descriptions.This theme is convert to Blogger by Premiumbloggertemplates.com.Download this template and more Premium Blogger Templates From PremiumBloggerTemplates.com...

  • SLIDE-3-TITLE-HERE

    Welcome to Blogger.Go to Blogger edit html and find these sentences.Now replace these text/sentences with your own descriptions.This theme is convert to Blogger by Premiumbloggertemplates.com.Download this template and more Premium Blogger Templates From PremiumBloggerTemplates.com...

  • SLIDE-4-TITLE-HERE

    Welcome to Blogger.Go to Blogger edit html and find these sentences.Now replace these text/sentences with your own descriptions.This theme is convert to Blogger by Premiumbloggertemplates.com.Download this template and more Premium Blogger Templates From PremiumBloggerTemplates.com...

Kamis, 21 April 2011

Mencari nilai Faktorial

Posted by Cipto Tri Raharjo On 20.43

#include <iostream.h>
#include <conio.h>
class faktorial {
public:
int proses();
void keluaran();
private:
int n,faktor;
};

int faktorial::proses()
{
cout<<"masukan angka yg akan di faktorialkan : ";
cin>>n;
faktor=1;
if(n>0)
{
for(int i=1; i<=n; i++)
{
faktor*=i;
}
}
else if(n=0)
{
faktor=1;
}
else
{
cout<<"tidak ada";
}
return faktor;
}
void faktorial::keluaran()
{
cout<<endl<<endl<<"faktorial dari "<<n<<"! = "<<faktor;
}
int main()
{
faktorial bilangan;
bilangan.proses();
bilangan.keluaran();
getch();
}

Rabu, 20 April 2011

Menggabungkan Bilangan

Posted by Cipto Tri Raharjo On 23.44

#include <iostream.h>
#include <conio.h>
#include <string.h>
class gabung{
friend ostream& operator<<(ostream&,gabung&);
friend istream& operator>>(istream&,gabung&);
public:
void kata();
private:
char kata1[10];
char kata2[19];
};
istream&operator>>(istream&in,gabung&x){
cout<<”\nmasukian bilangan 1 :”;
in>>x.kata1;
cout<<”masukan bilangan 2 :”;
in>>x.kata2;
x.kata();
return in;}
ostream&operator<<(ostream& out,gabung&x){
out<<”hailnya :”<<x.kata1<<endl;
return out;}
void gabung::kata(){
strcat(kata1,kata2);
cout<<”kata gabungan : “<<kata1<<endl;}
void main(){
gabung a;
cin>>a;
cout<<a;
getch();}

Program menghitung Volume bola

Posted by Cipto Tri Raharjo On 20.23

#include <iostream.h>
#include <conio.h>

class volume_bola {
public:
void volume();
void hitung();
private:
float v,r;
};
void volume_bola::volume(){
cout<<"PROGRAM MENGHITUNG VOLUME bola"<<endl;
cout<<"nilai r : "; cin>>r;
}
void volume_bola::hitung(){
v=4/3*(3.14*r*r*r);
cout<<"Volume Bola = " << v;
cout<<endl;
}
int main(){
volume_bola x;
x.volume();
x.hitung();

getch();
return 0;
}

Selasa, 19 April 2011

Program mencari Volume tabung

Posted by Cipto Tri Raharjo On 18.43

#include <iostream.h>
#include <conio.h>

class volume_tabung {
public:
void volume();
void hitung();
private:
float v,r,t;
};
void volume_tabung::volume(){
cout<<"PROGRAM MENGHITUNG VOLUME TABUNG"<<endl;
cout<<"nilai r : "; cin>>r;
cout<<"nilai t : "; cin>>t;
}
void volume_tabung::hitung(){
v=3.14*r*r*t;
cout<<"Volume Tabung = " << v;
cout<<endl;
}
int main(){
volume_tabung x;
x.volume();
x.hitung();

getch();
return 0;
}

Minggu, 17 April 2011

menghitung volume kubus

Posted by Cipto Tri Raharjo On 23.10

#include <iostream.h>
#include <conio.h>

class volumekubus {
public:
void volume();
void hitung();
private:
float v,s;
};
void volumekubus::volume(){
cout<<"PROGRAM MENGHITUNG VOLUME KUBUS"<<endl;
cout<<"nilai s : "; cin>>s;
}
void volumekubus::hitung(){
v=s*s*s;
cout<<"Volume Kubus = " << v;
cout<<endl;
}
int main(){
volumekubus x;
x.volume();
x.hitung();

getch();
return 0;
}

Deret

Posted by Cipto Tri Raharjo On 00.53

Algoritma Deret
{Membaca n (banyak suku), kemudian menentukan deret dari banyak suku tersebut}

#include <iostream.h>
#include <conio.h>
class Deret {
public :
int proses();
private :
int n;
};

int Deret::proses() {
cout << "Sampai berapa suku ? ";
cin >> n;
for (int i=0; i<=n; i++)
{
cout<<"1/"<< i<<" + ";
}
}

int main()
{
Deret x;
x.proses();
getch();
return 0;
}

Jumat, 15 April 2011

Menghitung luas_lingkaran

Posted by Cipto Tri Raharjo On 20.33

#include <iostream.h>
#include <conio.h>

class luas_lingkaran {
public:
void luas();
void hitung();
private:
float l,r;
};
void luas_lingkaran::luas(){
cout<<"PROGRAM MENGHITUNG LUAS LINGKARAN"<<endl;
cout<<"nilai r : "; cin>>r;
}
void luas_lingkaran::hitung(){
l=3.14*r*r;
cout<<"Luas Lingkaran = " << l;
cout<<endl;
}
int main(){
luas_lingkaran x;
x.luas();
x.hitung();

getch();
return 0;
}

Rabu, 13 April 2011

Program menentukan Tahun Kabisat

Posted by Cipto Tri Raharjo On 23.57

#include <iostream.h>
#include <string.h>
#include <conio.h>
class Kabisat{
private:
int l;
char tahun[4];
public:
Kabisat();
void hitungKabisat();
friend istream &operator >> (istream &in, Kabisat &);
friend ostream &operator << (ostream &out, Kabisat &);};
int main(){
Kabisat n;
cin >>n;
cout<<n;
system (“pause”);
return EXIT_SUCCESS;}
Kabisat::Kabisat(){
cout <<”Menentukan Tahun Kabisat”<< endl;}
void Kabisat::hitungKabisat(){
if ( l % 4 != 0)
strcpy(tahun,”Bukan Tahun kabisat”);
else
strcpy(tahun,”tahun kabisat”);}
istream &operator >> (istream &in, Kabisat &masukan){
cout<<”Lukman Reza Memasukan tahun : ” ;
in>>masukan.l;
return in;}
ostream &operator<<(ostream &out, Kabisat &tampil){
tampil.hitungKabisat();
out<<tampil.l<<”  “<<tampil.tahun<<endl;
return out;
}

Anda pasti tahu kan apa itu tahun kabisat...? tahun kabisat adalah tahun yang habis di bagi 4, tahun yang tidak habis di bagi 4 maka bukan tahun kabisat misalnya I sebagai tahun maka prosesnya  if ( l % 4 != 0).

Senin, 11 April 2011

Mencari nilai factorial dari suatu bilangan n

Posted by Cipto Tri Raharjo On 00.34

#include <iostream.h>
#include <conio.h>
class faktorial {
public:
int proses();
void keluaran();
private:
int n,faktor;
};

int faktorial::proses()
{
cout<<"masukan angka yg akan di faktorialkan : ";
cin>>n;
faktor=1;
if(n>0)
{
for(int i=1; i<=n; i++)
{
faktor*=i;
}
}
else if(n=0)
{
faktor=1;
}
else
{
cout<<"tidak ada";
}
return faktor;
}
void faktorial::keluaran()
{
cout<<endl<<endl<<"faktorial dari "<<n<<"! = "<<faktor;
}
int main()
{
faktorial bilangan;
bilangan.proses();
bilangan.keluaran();
getch();
}

Minggu, 10 April 2011

Program sederhana menghitung volume balok

Posted by Cipto Tri Raharjo On 17.13

#include <iostream.h>
#include <conio.h>

class volumebalok {
public:
void volume();
void hitung();
private:
float v,p,l,t;
};
void volumebalok::volume(){
cout<<"PROGRAM MENGHITUNG VOLUME BALOK"<<endl;
cout<<"nilai p : "; cin>>p;
cout<<"nilai l : "; cin>>l;
cout<<"nilai t : "; cin>>t;
}
void volumebalok::hitung(){
v=p*l*t;
cout<<"Volume Balok = " << v;
cout<<endl;
}
int main(){
volumebalok x;
x.volume();
x.hitung();

getch();
return 0;
}

Sabtu, 09 April 2011

Program Menjumlah n bilangan {Menjumlahkan sejumlah n bilangan}

Posted by Cipto Tri Raharjo On 22.07

#include <iostream.h>
#include <conio.h>

class menjumlahkan
{
public:
int proses();
void keluaran();
private:
int n;
float a,total;
};

int menjumlahkan::proses()
{
cout<<"Program Menjumlahkan Sejumlah Bilangan n";
cout<<"Masukkan jumlah angka n: ";
cin>>n;
total=0;
if(n>0)
{
for(int i=1; i<=n; i++)
{
cout<<"masukkan angka ke-"<<i<<" : ";
cin>>a;
total+=a;
}
}
else
{
cout<<"data tidak valid";
}
return total;
}
void menjumlahkan::keluaran()
{
cout<<endl<<endl<<"jumlah dari "<<n<<" bilangan = "<<total;
}
int main()
{

menjumlahkan x;
x.proses();
x.keluaran();

getch();
}

Jumat, 08 April 2011

Menentukan bilangan prima

Posted by Cipto Tri Raharjo On 20.24

Algoritma Menentukan bilangan prima
{membaca masukan bilangan n dan i , kemudian dianalisa , jika n mod i samadengan 0 maka faktor++ , jika faktor samadengan 2 ,maka tuliskan bilangan prima , jika tidak bukan bilangan prima}

#include<iostream.h>
#include<conio.h>
int main()
{
int i,n, faktor=0;
cout<<”Masukan bilangan n= “;
cin>>n;
for(i=1;i<=n;i++)
if(n%i==0)
faktor++;
if(faktor==2)
cout<<”bilangan “<<n<<” bilangan prima”;
else
cout<<”bilangan “<<n<<” bukan bilangan prima”;
getch();
return 0;
}

Kamis, 07 April 2011

program sederhana mencari KPK

Posted by Cipto Tri Raharjo On 20.18

Algoritma KPK
{membaca masukan n dan i kemudian diperiksa melalui perulangan for, jika i samadengan 1 , i kurangdari n maka i++ , jika n mod i samadengan 0 maka menuliskan hasil i}

#include <iostream.h>
#include <conio.h>
class kpk {
friend istream& operator>>(istream&, kpk&);
public :
kpk ();
private:
int a,b,nilai;
};
kpk::kpk() { cout<<”Menghitung KPK”<<endl; }
istream& operator>>(istream& in, kpk& masuk) {
masuk.nilai=0;
cout<<”Masukkan A: “; in>>masuk.a;
cout<<”Masukkan B: “; in>>masuk.b;
for (int z=1; z<=masuk.b; z++) {
masuk.nilai=masuk.nilai+masuk.a;
if (masuk.nilai%masuk.b==0) {
cout<<”KPK dari “<< masuk.a << ” dan “<< masuk.b <<” adalah “<< masuk.nilai <<endl;
return in;
}
}
}
int main () {
kpk X;
cin >> X;
getch ();
}

Rabu, 06 April 2011

Source code Sederhana dari C++ untuk mengetahui Predikat nilai menggunakan Branching if-else if-else if-...-else. Selamat mencoba kawan^^,

Posted by Cipto Tri Raharjo On 19.17

#include"stdio.h"
void main()
{
int nilai;
printf("Masukkan Nilai =");
scanf("%d",& nilai);
if(nilai>=90 && nilai<=100)
printf("Amat Baik");
else if(nilai>=75 && nilai<=89)
printf("Baik");
else if(nilai>=60 && nilai<=74)
printf("Cukup");
else if("nilai>=0 && nilain<=59");
printf("Kurang");
else
printf("Nilai yang Anda masukkan salah!");
}

Menentukan Keliling segitiga sama sisi

Posted by Cipto Tri Raharjo On 15.04

#include <conio.h>

#include <stdio.h>

#include <iostream.h>

void main()
{

float sisi, keliling;

clrscr();

cout<<"Masukkan Panjang Sisi Segitiga : ";

 cin>>sisi;

cout<<"Keliling Segitiga : ";

keliling = sisi + sisi + sisi;

cout<<"Kll = "<<sisi<<" + "<<sisi<<" + "<<sisi<<endl;

cout<<"Kll = "<<keliling;

getch();

}

Selasa, 05 April 2011

Mencari luas persegi panjang

Posted by Cipto Tri Raharjo On 17.13

Algoritma Menghitung Luas Persegi Panjang
{menetukan panjang dan lebar, algoritma menerima masukan nilai panjang dan lebar, menghitung luas persegi panjang,

#include <iostream.h>
#include <conio.h>
class persegi{
public:
persegi();
protected:
float s;
};
persegi::persegi(){
cout<<endl;
}
class luas : public persegi{
public:
void Luas_persegi(float);
private:
float L;
};
void luas::Luas_persegi(float a){
s = a;
L = s*s;
cout<<"Luas Persegi = "<<L<<endl;
}
int main()
{
persegi z;
float i;
cout<<"Masukkan Sisi = ";
cin>>i;
luas y;
y.Luas_persegi(i);
getch ();
return 0;
}

Minggu, 03 April 2011

Pernyataan do-while untuk menampilkan huruf abjad dari a – z.

Posted by Cipto Tri Raharjo On 20.07

#include <iostream.h>
#include <conio.h>
void main()
{
char abjad = ‘A’;
do
{
cout<<abjad<<” “;
abjad+=1;
}while(abjad <= ‘Z’)
getch();
}

Perulangan juga dapat digunakan dengan menggunakan pernyataan for seperti dibawah ini.

#include <iostream.h>
#include <conio.h>
void main()
{
char abjad;
for(abjad = ‘A’; abjad <= ‘Z’; abjad++)
{
cout<<abjad<<” “;
}
getch();
}

Sabtu, 02 April 2011

Mencari Luas Persegi

Posted by Cipto Tri Raharjo On 19.21

#include <iostream.h>
#include <conio.h> 
class persegi{
public:
persegi();
protected:
float s;
};
persegi::persegi(){ 
cout<<endl;
}
class luas : public persegi{
public:
void Luas_persegi(float);
private:
float L; 
};
void luas::Luas_persegi(float a){
s = a;
L = s*s;
cout<<"Luas Persegi = "<<L<<endl;
} 
int main()
{
persegi z;
float i;
cout<<"Masukkan Sisi = ";
cin>>i;
luas y;
y.Luas_persegi(i); 
getch ();
return 0;
}