waktu(clocklink.com)

Showing posts with label ilmu. Show all posts
Showing posts with label ilmu. Show all posts

27 November 2014

Tutorial C++ : How to determine positive, zero or negative number

In this session, i will discuss very simple program, it's about how to determine number. I use C++ to make this program and use if condition(if...else) to solve this problem.

Here is the source code :

#include<iostream>

using namespace std;

int main()
{
    int bil;
    cout<<"input number: ";
    cin>>bil;
   
    if (bil<0)
              {
              cout<<"negative\n";
              }
    else if (bil==0)
              {
              cout<<"zero\n";
              }
    else
              {
              cout<<"positive\n";
              }
       
system ("PAUSE");
return 0;

}

---***-----

i will analyze the meaning of that code.
#include<iostream>              //is library to determine cin(input) and cout(output)
int main()                              //this is the main program that will be execute
int bil;                                   //type is integer(number) and the name of variable is bil
cout <<"input number: ";     //display "input number: " to screen
cin>>bil;                              //if user enters number, the program scan that number as "bil"
 if (bil<0)
              {
              cout<<"negative\n";
              }
// if value of bil is less than 0, program will display negative

else if (bil==0)
              {
              cout<<"zero\n";
              }
// if value of bil is 0, program will display zero

else
              {
              cout<<"positive\n";
              }
// if value of bil is other, program will display positive to the screen.

system ("PAUSE");             //system will pause until user press a key
return 0;                        //it will end main function and the return value is 0(the program run correctly)

}

run this program and this is the result:



hope this tutorial is useful. . Keep trying!

24 November 2014

Tutorial Matlab


Kali ini saya akan membahas sedikit tentang cara menggunakan matlab. .Matlab ini saya gunakan untuk praktikum Aljabar Vektor Matriks. Langsung saja ke aplikasinya aja ya.

Misalnya saja membuat sebuah program,apabila kita menginputkan m=5 dan n=5 akan menghasilkan output :

1          2          3          4          5
2          4          5          6          4
3          5          6          7          3
4          6          7          8          2

5          4          3          2          1

Untuk menghasilkan output seperti itu, pertama-tama kita buka matlab, lalu masukkan source code m.file-nya seperti ini :


Agar lebih memahami maksud source code tersebut, mari kita analisis.Bila kita memasukkan nilai m=5 dan n=5, lalu kita lihat outputnya.

Pada baris pertama elemen-elemen matriks adalah 1 2 3 4 5
Untuk mendapatkan hasil tersebut,kita gunakan perintah  
                  if i==1  (pada baris pertama)
                          a(i,j) = j;  (nilainya sama dengan nomor kolom)
Pada baris terakhir  kita gunakan perintah
                  elseif i==m  (pada baris terakhir)
                          a(i,j) = n-v;  (nilainya sama dengan jumlah kolom dikurangi v)
                          v=v+1;  (v bertambah setelah perulangan)
akan tetapi,kita tentukan dahulu nilai v-nya yaitu  0.Ini artinya apabila kita memasukkan nilai m=5 maka pada
Eksekusi pertama n-v=5-0=>5      (baris 1 kolom 1)
setelah itu,bisa kita lihat ada perintah selanjutnya v=v+1 =0+1==>1, v sudah berubah menjadi 1 bukan lagi 0
Eksekusi kedua n-v=5-1=>4                     (baris 1 kolom 2)
Eksekusi itu berulang jadi pada eksekusi-eksekusi selanjutnya v berubah menjadi 2,3 lalu 4.dan ini menyebabkan nilai pada baris terakhir menjadi
5 4 3 2 1

Pada kolom pertama,hasilnya adalah
1
2
3
4
5
Untuk mendapatkan hasil tersebut,kita gunakan perintah 
                  if j==1
                          a(i,j) = i;
Pada kolom terakhir  kita gunakan perintah
                  elseif j==n
                          a(i,j)=  n-w;
                          w=w+1;
akan tetapi,kita tentukan dahulu nilai w-nya yaitu  1.Ini artinya apabila kita memasukkan nilai m=5 maka pada
Eksekusi pertama n-w=5-1=>5     (baris 2 kolom 5)karena baris 1 kolom 5 sudah terisi oleh perintah sebelumnya.
setelah itu,bisa kita lihat ada perintah selanjutnya w=w+1 =1+1==>2,w sudah berubah menjadi 2 bukan lagi 1
Eksekusi kedua n-w=5-2=>3                    (baris 3 kolom 5)
Eksekusi ini juga berulang jadi pada eksekusi-eksekusi selanjutnya w berubah menjadi 4.dan ini menyebabkan nilai pada kolom terakhir menjadi
5
4
3
2
1

Pada elemen-elemen matriks bagian tengah,bila kita amati nilainya adalah jumlah elemen matriks i dengan j,jadi kita gunakan perintah :
      else i==j
                  a(i,j) = i+j;

Semoga tutorial singkat ini bisa memberikan pencerahan. .

30 December 2012

Synopsis of Bucket List and It's Moral Value


The movie start when Charter get telephone from someone,a doctor of famous hospital.He is told that he get cancer.So,he hold off phone.In other place,there is a meeting and all member of meeting is waiting for the owner of hospital to talk.But he just drink Luwak Coffee,best Coffee in the world from Sumatra.After that,he start to talk,but he vomiting of blood.He be carried to his own hospital,he got cancer too.After arrive in his room,he meets Carter.Day by day,they be good roommate,Edward had an operation but none visit Edward,only his personal valet who visit him.His personal valet name is Thomas.Edward makes Thomas and his doctor,Morrow to serve Carter as well as him.
They become so chumy,they often play card and watch television together.One day,Charter write a “bucket list”,bucket list contains things that he wants to do before he kicks the bucket or die.But,he thinks that all of that is impossible because his life is short,so he throw away that list.In the morning,Thomas put the list give it to Edward,he tell Carter to do all on the list.He suggesting to add skydiving to the list.He offers to finance the trip.Carter thinks of that and he agree,he tell his wife,Virginia that he will take a trip,although his wife disagree,they steady take a trip.
One by one,the list is crossed off,but there is thing that unfinished to do,Carter  die,he request Edward to finish their bucket list without him and Edward must finish that for him.Edward agree.In the end of movie,Thomas bring edward’s ashes to the top of Himalaya mountain.He places that alongside a can that containing of Charter’s ashes.Then,he crosses off the last thing on the bucket list,witness something truly majestic and places that beside them.
The messages of the bucket list movie are life is not enjoy while you can and fit in all you can, live your dreams and don’t die with any regrets, always tie up loose ends and make it up with people you love rather than have them live a life with sadness due to the fact that they didn’t make it up with you.
Enjoy your life your only here once and if you can make other peoples lives happier.Never leave the ones you love most, enjoy life while you can do what you want to do for you never know when you will die.
I think this movie is good,this movie make me realize that I should enjoy my life.beside that,I should brought joy to other people.This movieis so inspirate my life!!

19 November 2012

Kloning

Post kali ini,singkat aja ya...aku akan membahas kloning,,apa sih kloning?gimana sih proses kloning yang simpel,gak beribet bahasanya?
Langsung aja ya..
Kloning adalah proses menghasilkan individu dari jenis yang sama yang mirip secara genetik.

Proses kloning manusia:
a). Mempersiapkan sel stem( suatu sel awal yang akan tumbuh menjadi berbagai sel tubuh)
b). Mempersiapkan sel telur
c). Inti sel dari sel stem diimplantasikan ke sel telur
d). Setelah membelah (hari kedua) menjadi sel embrio
e). Sel embrio diimplantasikan ke dalam Rahim
f). Embrio tumbuh dalam rahim menjadi bayi dengan kode genetik persis sama dengan sel stem donor