Jumat, 10 Juni 2011

CaLcuLator



calculator was created using C + + programming language and is divided into 3 files. Next functions

are:
void kalkulator::perpangkatan (){
system("cls");
int pil;
cout<<"1.Pangkat 2\n2.Pangkat 3";
cout<<"\nMasukkan pilihan : ";
cin>>pil;
switch(pil){
case 1:
cout<<"\nmasukkan nilai x : ";
cin>>x;
cout<<"hasil perpangkatannya adalah = "<<<"\n\n";break;
case 2:
cout<<"\nmasukkan nilai x : ";
cin>>x;
cout<<"hasil perpangkatannya adalah = "<<<"\n\n";break;

}
}

void kalkulator::akar_kuadrat (){
cout<<"masukan nilai x = ";
cin>> x;
hitung=sqrt(x);
cout<<"hasilnya adalah = "<<<"\n"<
}
void kalkulator::exponensial (){
cout<<"masukan nilai x = ";

cin>> x;
hitung=exp(x);
cout<<"hasilnya adalah = "<<<"\n"<

}
void kalkulator::sinus (){
cout<<"Sin dari = ";

cin>> x;
float pi =3.14;
hitung = sin (x*pi/180);
cout<<"hasilnya adalah = "<<<"\n"<

}
void kalkulator::cosinus (){
cout<<"Cos dari = ";

cin>> x;
float pi =3.14;
hitung = cos (x*pi/180);
cout<<"hasilnya adalah = "<<<"\n"<

}
void kalkulator::tangen (){
cout<<"Tangen dari = ";

cin>> x;
float pi =3.14;
hitung = tan (x*pi/180);
cout<<"hasilnya adalah = "<<<"\n"<
}

Rabu, 08 Juni 2011

Arithmetic Series (deret aritmatika)


Arithmetic series in the field of mathematics is the sequence number in which the next number of additions to the previous number by a number of specific differences. Examples are 3,5,7,9,11,13, ..... Arithmetic series can be expressed with the following formula:

a, a + b, a + 2b, a + 3b, ...

In this case the n-th quarter:

\ a_n = a + (n - 1) b,

The total of all quarters:

S_n = \ frac {n} {2} (a + a_n) = \ frac {n} {2} [2a + (n-1) b].

For example, the sum total of a quarter to quarter of an = 3 + (n-1) (5) up to a quarter-50 is

S_ {50} = \ frac {50} {2} [2 (3) + (49) (5)] = 6.275.

Algorithm deret aritmatika :
Deklarasi:
float a, b, n, un, sn: Integer
int x;

Deskripsi:
For
← (x = a, x <= un, x = x + b) a 1.0 ←, b ← 2.0; ← printf ("+% i ", x); EndFor write (Deret aritmatika)
following his program c + + :


#include
#include

using namespace std;

int main(int argc, char *argv[])
{
//deklarasi data
float a,b,n,un,sn;
int x;
//badan program
printf("Program Penghitung Deret Aritmatika");
printf("\nMasukkan:");
printf("\nSuku ke n = ",n);
scanf("%f",&n);

a = 1.0;
b = 2.0;

un = a + (n-1)*b;
sn = (0.5*n)*(a+un);

printf("\nMaka Nilai dari Un = %f\n",un);
printf("\nNilai Sn = %f\n",sn);

printf("\nSelanjutnya\n");
printf("\nUn = %f\n",un);
printf("\nDeret aritmatika untuk %f adalah :\n\n",un);

for(x=a;x<=un;x=x+b) { printf("+%i ",x); } system("PAUSE"); return EXIT_SUCCESS; }

Jumat, 06 Mei 2011

JAVA program Calculating Area and Volume of Balls


The ball is hand built curved space bounded by a curved area. The ball can be formed from the wake half-circle that rotated as far as 360 ° in diameter.

Algorithm to find the ball wide:

Input the radius = r
Input pi = 3.14
Calculate the area of
​​L = pi * r * r
Print Size L.


Volume ball search algorithm


Input the radius = r
Input pi = 3.14
Calculate the volume V = pi * r * r * r
Print Volume V.

The following program :

import jeliot.io.*;

public class GlobalMembers
{
public static void main()
{
libo x = new libo();
x.masukan();
System.out.print(" hasilnya adalah \n");
x.ngitung();
}
}

public class libo
{
public final void masukan()
{
System.out.print("masukkan nilai r :");
r = Input.readInt();
}
public final void ngitung()
{
pi +=3.14;
volume =(4/3)*pi*r*r*r;
luas =pi*r*r;
System.out.print("luas =");
System.out.print(luas);
System.out.print("\n");
System.out.print("volume =");
System.out.print(volume);
System.out.print("\n");
}
private int r;
private float pi ;
private float volume ;
private float luas ;

}

Kamis, 14 April 2011

Looking for the Biggest or Smallest Numbers


One simple algorithm problem is finding the largest or smallest numbers, where numbers are entered by the user. For example, look for the largest or smallest numbers among the 3 pieces of number of input by the user. We can answer these questions and look for the largest or smallest numbers using the service conditions are available in C + + programming language.
But generally to seek the largest or smallest numbers like this, the programmer will use the IF statement because it is easier to understand and more flexible. For more details, please refer to C + + program below to find the largest numbers:

# Include <iostream>
# Include <conio.h>

void main ()
{
   court <<"Program Seeking Numbers Greatest" <<endl;
   int bil1, bil2, bil3, the largest;
   court <<"Enter number 1:";
   cin>> bil1;
   court <<"Enter number 2:";
   cin>> bil2;
   court <<"Enter number 3:";
   cin>> bil3;
   if (bil1> bil2)
      largest = bil1;
   else
      largest = bil2;
   if (bil3> biggest)
      largest = bil3;
   court <<"Biggest number =" <<largest;
   getch ();
}



Explanation of the program to find the largest numbers:
Initially the program will prompt the user to enter three numbers that bil1, bil2 and bil3. Then the program will compare between bil1 and bil2, if it turns out bil1 larger, it is considered the biggest stuffed with bil1 value, if otherwise then terbesardiisi with bil2. Next live compare between bil3 with the largest, if turns out bil3 bigger than the biggest, the greatest value is replaced again with bil3 value.
In the end the largest will be filled with the largest number among the three numbers entered by the user. As an exercise, please modify the above program for a program to find the largest number among the 4 fruit number that entered by the user. Good luck, if you do not succeed and the curious way, please contact me at wirautama06 [at] yahoo.com.