• 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...

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;
}