Selasa, 04 Desember 2012

Tugas 2 Dasar-Dasar Pemrograman

Faktorial menggunakan for

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    int n;
    int hasil = 1;
    cout<<"masukan nilai faktorial= ";
    cin>>n;
    for(int i=1; i<=n; i++){
            hasil *=i;
            if(i>1) cout<<"x";
            cout<<i;
            }
            cout<<"= "<<hasil;
            cout<<endl;
    system("PAUSE");
    return EXIT_SUCCESS;
}




Senin, 24 September 2012

Tugas1 Dasar-Dasar Pemrograman


#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    char nama [25];
    int nim;
    char kelas [25];
   
    cout<<"Program Biodata Mahasiswa"<<endl;
    cout<<"Masukkan Nama    : ";
    cin>>nama;
    cout<<"Masukkan NIM     : ";
    cin>>nim;
    cout<<"Masukkan Kelas   : ";
    cin>>kelas;
   
    cout<<"dan inilah Biodata Mahasiswa:"<<endl;
    cout<<"Nama       : "<<nama<<endl;
    cout<<"NIM        : "<<nim<<endl;
    cout<<"Kelas      : "<<kelas<<endl;
   
   
   
    system("PAUSE");
    return EXIT_SUCCESS;
   
}

Rabu, 19 September 2012

reflection of the second meeting STRUKTUR DATA



second meeting lecture really made me confused. because not mepersiapkannya. I've actually read sekenarionya. but I suppose the friends of the TP I've prepared. apparently not. at the lecture today made me realize it is important to prepare before classes begins. though do not understand what it means but at least know their duties.

I actually do not understand the purpose of the STRUCT and CLASS. Our discussion group was also not understand the application of struct and class together in a single program. that is why in our presentation, we were confused what want in persentasikan.

I worry if I still do not understand struct and class that would make me difficult to understand subsequent material ..
I hope if intentions and diligently i can past this second meeting. hopefully more mentoring can help me ... amen ..

\ * o * /

reflection of the first meeting STRUKTUR DATA



bismilahhirohmannirrohim

today the first meeting of a data structure. I knew from day one bonus value already started. but I deliberately late, it is not for getting a bonus value just that I feel that I've been trying to find the value of bonuses and instead only made ​​that mistake once and lost opportunity, it really makes me more upset. and I do not want to feel disappointed.

I'm afraid if i feel disappointed because i are not received my bonus value not spirit to learn the structure of the data. i think lectures are not only looking for bonus points but to understand what is learned. value can not necessarily make us better, but understanding can make us better in applying.

I hope,, hopefully I can be more accepting and understanding the data structures. starting from the first meeting to discuss BASIC PROGRAMMING C + +. because this is a battle I have  to fight..

fighting fighting ... :)

Rabu, 30 Mei 2012

Tugas Pemrograman Web

Live Preview : http://habibnurrahman.com/pweb/
Download source-code : http://www.mediafire.com/?hpb5nzg3b66653z
Kelompok:
11018078 – Riantini
11018089 – Istiqomah Dwi Susanti
11018099 – Habib Nurrahman
11018100 – Eka Yogie Basenda
11018108 – Heni Sulistyorini

Selasa, 17 April 2012

Algoritma Lingkaran

Deklarasi :
Konstanta
              phi = 3,14
              r : integer         {input}
              keliling,luas : real  {output}

Deskripsi :
              read(r)
              keliling = 2*phi*r
              luas = phi*r*r
              write(keliling,luas)


Flowchart

Algoritma Menghitung Konversi Suhu

{Masukan integer derajat Celcius (C),
menghitung ekivalensinya dalam derajat Reamur (R), Fahrenheit (F), dan Kelvin(K).kemudian menampilkan hasilnya di layar}

Deklarasi:
C  : real   : {derajat Celcius, input}
R  : real  : {derajat Reamur, output}
F  : real  : {derajat Fahrenheit, output}
K  : real  : {derajat Kelvin, output}

Deskripsi:
read (C)
R = 4/5*C
F = 9/5*C+32
K = C+273
write (R,F,K)


Flowchart
 

Algoritma Mencari n Faktorial

Deklarasi :
i,n : integer
faktorial : longint

Deskripsi :
read(n)
faktorial =1
for i=1 to n do
faktorial=faktorial*i
endfor
write(faktorial)



Flowchart



programnya

#include <iostream.h>
#include <conio.h>
class Operator{
friend ostream& operator<<(ostream&, Operator&);
friend istream& operator>>(istream&, Operator&);
public :
long faktorial();
private:
int n;
long hasil;
};
long Operator::faktorial(){
long fak=1;
for(int=1; i<=n; i++)
fak=fak*i;
return fak;
}
ostream& operator<<(ostream& out, Operator){
a.hasil=a.faktorial();
out<<"Hasil cara iterasi :"<<a.n<<"! adalah "<<a.hasil;
return out;
}
istream& operator>>(istream& in, Operator){
cou<<"Masukkan integer n :";
in>>a.n;
return in;
}
void main(){
Operator run;
cin>>run;
cout<<run;
getch();
}
system ("PAUSE");
return EXIT_SUCCESS;
}

Algoritma Mencari Jumlah Deret

Deklarasi :
n,jumlah,x : integer
rata : real

Deskripsi :
jumlah=0
i=1
repeat
julmah=jumlah+(1/i)
i=1+1
selisih=(1/i)-(1/(i-1))
until about(selisih)<0,001
write(jumlah,i)


Flowchart



Programnya


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

class Deret{
 friend ostream& operator<<(ostream&, Deret&);
 public :
         float hitung_Deret();
 private:
         int n;
         float hasil;
 };

float Deret:: hitung_Deret(){
 float selisih,jumlah=0.0;
 int i=1;
 do{
 jumlah+=1.0/(i-1)-1.0/i;
 }while(selisih>=0.001);
 cout<<"Perulangan dilakukan sebanyak :"<<i<<endl;
 return jumlah;
 }

ostream& operator<<(ostream& out, Deret&){
 out<<"Jumlah deret ="<<A.hitung_Deret();
 return out;
 }

void main(){
 Deret X;
 cout<<X;
 }
system ("PAUSE");
return EXIT_SUCCESS;
}

akar imajiner

read (a,b,c)
disk = b*b-4*a*c
if (a=0) then write (‘bukan persamaan kuadrat’)
else if disk > 0 then
x1 (-b +sqrt(disk)/2*a
x2 (-b -sqrt(disk)/2*a
else if disk=0 then
x1 (-b/2*a)
x2 (x1)
else write (‘akar imajiner’)
end if
write (x1,x2)

Flowchart

menentukan nilai maksimum dan minimum dari n bilangan [array]

procedure maks_min(input data :larik; n:integer; output m1,m2:integer)
Deklarasi
i:integer

Deskripsi
m1 <-data[1]
m2 <-data[1]
for i <- 2 to n do
if (data[i]>m1) then m1 <- data[i];
if (data[i]<m2) then m2 <- data[i];
endfor

Flowchart

menentukan nilai maksimum dari n bilangan dgn [array]

function maksimum(input data :array [1..10] of integer, n:integer): integer
Deklarasi
i,temp: integer

Deskrips
temp <- data[1]
for i<- 2 to n do
temp <- maksimum2(temp, data[i])
maksimum <- temp

Flowchart


nilai deviasi standar dari n buah data

Deklarasi
i,jumlah:integer

Deskripsi
jumlah <- 0
for i <- 1 to n do
jumlah <- jumlah + sqrt(x[i]-rata)
endfor
std<- sqrt(jumlah/(n-1))

Flowchart


rata-rata dari n bilangan bulat dengan menggunakan array

Deklarasi

 i, jumlah: integer
Deskripsi
jumlah <-0
for i <- 1 to n do
jumlah<-jumlah +x[i]
endfor
rata<-jumlah/n

Flowchart

fungsi penjumlahan

flowchart

fungsi faktorial secara rekursif untuk mencari n

flowchart




   

fungsi perkalian 2 bilangan bulat dengan menggunakan operator penjumlahan

Flowchart

 

fungsi yang menentukan nilai terbesar dari 2 bilangan bulat

flowchart








programnya

#include <iostream>
#include <string>

using namespace std;
int main()
{
   string raptor_prompt_variable_zzyz;
   int a;
   int b;

   raptor_prompt_variable_zzyz ="masukan nilai a";
   cout << raptor_prompt_variable_zzyz << endl;
   cin >> a;
   raptor_prompt_variable_zzyz ="masukan nilai b";
   cout << raptor_prompt_variable_zzyz << endl;
   cin >> b;
   if (a>b)
   {
      cout << "nilai terbesar adalah "<<a << endl;   }
   else
   {
      cout << "nilai terbesar adalah "<<b << endl;   }

   system ("pause");
   return 0;
}

Minggu, 15 April 2012

Refleksi Alpro pertemuan ke-6

in reflection of this meeting to six times its news late really. but not a problem, always post ..

ok we start ..
this meeting really exciting. we first discuss the matter Alpro. understood less as usual. and there is a different, usually empty my notes. but with a written explanation from the lecturer's first record Alpro begins .. Hhahahaa ....
explanation of the cases into five exercises in the meeting.

complete explanation of the faculty, we began to excitement in the classroom.
the professor asked nine people to come forward. one of which was chosen as chairman of the team .. our next task was given ..

this task:
foreman was given a sentence (about 10 words). Each time getting a word (of course in a whisper) the head of the team would deliver the message to his friend by not mentioning the word ONE (or LAST to give up that matter). The second person will pass the word to NOT mention the word (or both LAST) and so on. up to the last, will receive messages only ONE word (or complete sentences).

this task as a game. but a serious game. because of this game is a description of the recursive ..

eehhhmmm,,, eah as usual ... although exciting but still less understood. keep the spirit and fighting ..

reflection so this time ..
thank you ..

Selasa, 10 April 2012

Refleksi Alpro pertemuan ke-7


post at the start ..
this meeting to discuss about the array. but the array is what??
Array is a structured data type that can store lots of data with a same name and occupy a place in memory of successive (contiguous) and the same data type.


brief explanations. further how the application of the array in everyday life?
one discussion group that I referred to in that group to give an example. ie on the use of the refrigerator.


indexnya as follows:
A. placed in the kitchen refrigerator
2. select the type of food and beverages
3. grouping of foods and beverages
4. put the appropriate place


input: input materials or goods to the consumer
process: food and beverages classified according to its place.
output: the result of food or beverage ingredient groupings based on the space provided.
explanation:
For example in the refrigerator, the preparation of food in the fridge with a variety of criteria types. eg drinks placed on the refrigerator door. We can classify food or drink in the space provided for the material in accordance with their own kind.


Thus my post this time ..
Thank you.

Selasa, 27 Maret 2012

Refleksi Alpro pertemuan ke-5

ehemm ehemm.. asik asik..
minggu ke lima kali ini bener seru. tapi seperti biasa saiia datang tidak begitu terlambat.. ngepas lewat dikit.. :p

pertemuan kali ini membahas tentang "Function"... tapi refleksi kali ini berbeda dari sebelumnya. posting dengan bahasa inggris.. eah di coba,, minta bantuan mbah google iak.. translatein donk mbahh... XD


ok. from a description of the function ..
  • Basically the function returns a value
  • Function that does not return value is a procedure (which returned void)
  • Sometimes there is more than one parameter that changes its value in the function

of the explanation is given in some cases. but first, as always, we divided into groups. There are different this time. we are given a task to exchange the raptor had ever done before. of exchange of some of our group can complete the cases unresolved at the previous meeting. so it can post to the blog and for understanding the case.

so pretty this time of reflection. I think this meeting may help to clarify and better utilization of the use of raptors .. may be useful ..

and thank you so .. : p

Senin, 26 Maret 2012

CLASS ACTIVITY (Alpro-1)

Menulis algoritma sederhana untuk menarik sejumlah uang di ATM

Pengambilan Uang di ATM
>masuk ke dalam ruang mesin ATM
>ambil kartu ATM
>masukkan kartu ATM kedalam mesin ATM
>pilih bahasa yang akan digunakan Indonesia/ Inggris
>tulis nomor Pin (password)
>pilih transaksi yang ingin dilakukan
>pilih bagian “Penarikan Uang” yang ada pada layar
>pilih nominal uang yang akan diambil dan tekan OK/YES
>tunggu proses berlangsung
>uang akan Keluar dari mesin ATM dan Kartu ATM juga ikut keluar
>setelah kartu dan uang keluar maka akan keluar potongan kecil yang berisi rincian penarikan uang
>dan Anda dapat meninggalkan ATM tersebut.

Minggu, 25 Maret 2012

mencetak bilangan ganjil dari 0 sampai 10

Flowchart



















Programnya
#include <iostream>
#include <string>
using namespace std;
int main()
{
   int i;
   i =1;
   while
(!(i>10))
   {
      if (i % 2==0)
      {
      }
      else
      {
         cout << i << endl;      }
      i =i+1;
   }
   system("pause");
   return 0;
}

Menampilkan Rata-rata dari n bilangan bulat positif

Flowchart



programnya
#include <iostream>
#include <string>

using namespace std;
int main()
{
   string raptor_prompt_variable_zzyz;
   int n;
   int rata;
   int x;
   int i;
   int jumlah;

   raptor_prompt_variable_zzyz ="n =";
   cout << raptor_prompt_variable_zzyz << endl;
   cin >> n;
   jumlah =0;
   i =1;
   while (!(i>n))
   {
      raptor_prompt_variable_zzyz ="x =";
      cout << raptor_prompt_variable_zzyz << endl;
      cin >> x;
      jumlah =jumlah+x;
      i =i+1;
   }
   rata =jumlah/n;
   cout << jumlah << endl;   cout << rata << endl;
   system("pause");
   return 0;
}

menampilkan bilangan fibonacci (Loop)

Flowchart

Menghitunng perulangan rata-rata

Flowchart


















Programnya
#include <iostream>
#include <string>

using namespace std;
int main()
{
   string raptor_prompt_variable_zzyz;
   int n;
   int rata;
   int x;
   int i;
   float jumlah;

   raptor_prompt_variable_zzyz ="masukan n=";
   cout << raptor_prompt_variable_zzyz << endl;
   cin >> n;
   jumlah =0;
   i =1;
   while (!(i>n))
   {
      raptor_prompt_variable_zzyz =" masukan x=";
      cout << raptor_prompt_variable_zzyz << endl;
      cin >> x;
      jumlah =jumlah+x;
      i =i+1;
   }
   rata =jumlah;
   cout << rata << endl;
   system("pause");

   return 0;
}

mencetak angka 1 sampai 4

Flowchart


















Programnya
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
cout<<"ini adalah program untuk menampilkan angka 1 sampai 4"<<endl;
for(int C=1;C<5;C++){
cout<<C<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}

mencari akar persamaan kuadrat

Flowchart


Programnya
#include <iostream>
#include <string>

using namespace std;
int main()
{
   string raptor_prompt_variable_zzyz;
   float x2;
   float D;
   int b;
   int c;
   float x1;
   int a;

   raptor_prompt_variable_zzyz ="A = ";
   cout << raptor_prompt_variable_zzyz << endl;
   cin >> a;
   if (a!=0)
   {
      raptor_prompt_variable_zzyz ="B = ";
      cout << raptor_prompt_variable_zzyz << endl;
      cin >> b;
      raptor_prompt_variable_zzyz ="C = ";
      cout << raptor_prompt_variable_zzyz << endl;
      cin >> c;
      D =b^2-(4*a*c);
      if (D==0)
      {
         x1 =-b/2*a;
         x2 =x1;
         cout << "x1 = "<<x1<<" dan x2 = "<<x2 << endl;      }
      else
      {
         if (D>0)
         {
            x1 =(-b+sqrt(D))/2*a;
            x2 =(-b-sqrt(D))/2*a;
            cout << "x1 = "<<x1<<" dan x2 = "<<x2 << endl;         }
         else
         {
            cout << "akar imajiner" << endl;         }
      }
   }
   else
   {
      cout << "bukan persamaan kuadrat" << endl;   }
system("pause");
   return 0;
}