Rabu, 20 November 2013

Aplikasi Sederhana PEMBELIAN HANDPHONE dengan Bahasa Pemrograman C++

Asalamualaikum wr wb

         Posting kali ini saya akan share mengenai pembuatan aplikasi sederhana dengan bahasa pemrograman C++. Aplikasi ini mengenai pembelian Handphone dimana user dapat memilih Handphone yang ingin di beli. Hasil dari program adalah sebagai berikut :


========================================================================
SOURCE CODE 

/*
APLIKASI PEMBELIAN HANPDHO DENGAN C++
NAMA : DIANA MAYANGSARI RAMADHANI
NRP  : 49013047
*/

#include <iostream>
using namespace std;

int main(){
int i; //input pilihan
char nama[100]; //array nama
char alamat[100]; //array alamat

cout << "Diana Mayangsari Ramadhani\n";
cout << "NRP : 49013047\n\n \n";

cout << "_____________________________________________\n";
cout << "               PEMBELIAN HANDPHONE           \n";
cout << "*********************************************\n \n";

cout << "Masukan nama   : ";
cin.getline (nama, 100); //input nama disimpan di array nama
cout << "Masukan alamat : ";
cin.getline (alamat, 100); //input alamatdi simpan di array alamat
cout << endl << endl;
cout << "Daftar Handphone  : \n \n";
cout << "1. Samsung Galaxy S4\n";
cout << "2. BlackBerry A10\n";
cout << "3. Sony Experia Z1\n";
cout << "4. Nokia Lumia 1020\n";
cout << "5. Apple iPhone 5\n \n";
awal: //pemberian variable agar nanti dapat di panggil saat y/n
cout << "Masukan pilihan anda : ";
cin >> i; //input pilihan
cout << endl;


cout << " " << nama <<endl; //menampilkan isi array nama
cout << " " << alamat << endl; //menampilkan isi array alamat

//kondisi switch case
switch(i){ 
case 1:
cout << "Anda membeli ~Samsung Galaxy S4~ \n \n";
cout << "SPESIFICATION\n";
cout << "- Sistem Operasi Android 4.2.2 (Jelly Bean)\n";
cout << "- Chipset Octa Core Processor\n";
cout << "- Kamera 13Megapixel(Rear), 2Megapixel(front)\n";
cout << "- Baterai 2600mAh, 370hours StandbyTime\n";
cout << "- Display Full HD AMOLED, 5inch, 1920*1080 Resoution\n";
cout << "- Audio dan Video Full HD(1080p), Recording up to 30fps\n";
cout << "========================\n";
cout << "Harga : Rp 6.000.0000,00\n";
cout << "========================\n \n";
break;
case 2:
cout << "Anda membeli ~BlackBerry A10~ \n \n";
cout << "SPESIFICATION\n";
cout << "- Sistem Operasi BlackBerry 10.2\n";
cout << "- Chipset Qulacomm Snapdragon, Dual core 1.7 Ghz Krait\n";
cout << "- Memory internal 16Gb, 2Gb RAM\n";
cout << "- Kamera 8Megapixel, 3264x2448 pixel\n";
cout << "- Baterai 2800mAh\n";
cout << "- Display 720x1280 pixel, 5inch, 16M colors\n";
cout << "========================\n";
cout << "Harga : Rp 7.500.0000,00\n";
cout << "========================\n \n";
break;
case 3:
cout << "Anda membeli ~Sony Xperia Z1~ \n \n";
cout << "SPESIFICATION\n";
cout << "- Sistem Operasi Android 4.2 (Jelly Bean)\n";
cout << "- Chipset Qulacomm MSM8974, 2.2GHz\n";
cout << "- Memory RAM 2Gb, Internal 16Gb, External up to 64Gb\n";
cout << "- Kamera 20,7Megapixel(Rear), 2Megapixel(front)\n";
cout << "- Daya Tahan Air dan Debu (IP5X dan IP8X)\n";
cout << "- Baterai 880hours StandbyTime\n";
cout << "- Display Full HD TRILUMINOS, 5inch, 1920*1080 Resoution\n";
cout << "========================\n";
cout << "Harga : Rp 8.500.0000,00\n";
cout << "========================\n \n";
break;
case 4:
cout << "Anda membeli ~Lumia 1020~ \n \n";
cout << "SPESIFICATION\n";
cout << "- Sistem Operasi Microsoft Windows Phone 8\n";
cout << "- Chipset Qulacomm MSM8960 Snapdragon, 1.5GHz krait\n";
cout << "- Memory RAM 2Gb, Internal 64Gb\n";
cout << "- Kamera 41Megapixel Carl Zeiss optics\n";
cout << "- Baterai 2000mAh 384hours StandbyTime\n";
cout << "- Display AMOLED 16M colos, 768x1280 Resoution\n";
cout << "========================\n";
cout << "Harga : Rp 7.500.0000,00\n";
cout << "========================\n \n";
break;
case 5:
cout << "Anda membeli ~Apple iPhone 5~ \n \n";
cout << "SPESIFICATION\n";
cout << "- Sistem Operasi iOs 6.1.4 - iOs 7.0.3\n";
cout << "- Chipset Apple A6, Dual Core 1.3GHz Swift\n";
cout << "- Memory Internal 64 Gb, 1Gb RAM\n";
cout << "- Kamera 8Megapixel(rear), 1.2Megapixel (front)\n";
cout << "- Baterai Li-Po 1440mAh, 225hours StandbyTime\n";
cout << "- Display LED-backlit IPS LCD, 4inch, 640x1136pixel\n";
cout << "=========================\n";
cout << "Harga : Rp 10.000.0000,00\n";
cout << "=========================\n \n";
break;
}

char pilih; /*mendeklarasikan pilih dengan tipe char*/
 cout << "Apakah anda yakin untuk memilih handphone ini? (y/n)"; /*menampilkan tulisan "apakah anda yakin untuk memilih mobil ini? (y/n)"*/
 cin >> pilih; /*memasukkan input ke variabel pilih*/
  if (pilih=='n'||pilih=='N') /*menyatakan kondisi jika variabel pilih==n*/
  {
   goto awal; /*berfungsi untuk loncat ke variabel awal*/
   }
 cout << "TERIMA KASIH\n \n";/*menampilkan tulisan "TERIMA KASIH"*/
 return 0;/*menghentikan fungsi main*/

system ("pause");
return 0;
}

========================================================================

VIDEO TUTORIAL DAPAT DI LIHAT DI


Aplikasi Sederhana MENENTUKAN NILAI (IP) MAHASISWA dengan C++


Asamualaikum wr wb
Pada posting kali ini saya akan share mengenai program sederhana dengan bahsa pemograman C++ yaitu tantang menentukan nilai (IP) mahasiswa, sebelumnya saya kan menunjukan hasil dari program yaitu :


======================================================================
SOURCE CODE

/*
APLIKASI MENENTUKAN NILAI MAHASISWA
NAMA : DIANA MAYANGSARI RAMADHANI
NRP  : 49013047
*/
#include <iostream>
using namespace std;

int main(){
cout << "Diana Mayangsari Ramadhani\n";
cout << "NRP : 49013047\n\n \n";

cout << "APLIKASI MENENTUKAN NILAI INDEKS PRESTASI MAHASISWA\n";
cout << "---------------------------------------------------\n" <<endl;

cout << " Nilai Huruf \n";
cout << " ____________\n";
cout << "|           A+        |\n";
cout << "|            A         |\n";
        cout << "|            B+       |\n";
cout << "|             B         |\n";
cout << "|            C+        |\n";
cout << "|            C          |\n";
cout << "|            D+        |\n";
cout << "|            D          |\n";
cout << "|             E         |\n";
cout << "|____________|\n"<<endl <<endl;

int matkul; // untuk inputan jumlah mata kuliah
char nilai[10], c[1]; //array  menampung nilai
float nil=0, nil2=0; //variable nil untuk di proses
float ips; //variable hasil akhir ip
int n_sks, t_sks=0; // jumlah sks dan proses sks

cout << "Masukan jumlah matakuliah : ";
cin >> matkul;
cin.getline(c,1); //agar dapat mengambil cin getline nilai
//perulangan sebanyak matkul
for (int a=1; a<=matkul; a++)
{
cout << a << ". Nilai huruf = "; //cetak
cin.getline(nilai, 3); //inputan
cout << "   Jumlah sks  = "; //cetak
cin >> n_sks; //inputan
if (strcmp(nilai, "A+") == 0 || strcmp(nilai, "a+") == 0)
nil += (4 * n_sks);
else if (strcmp(nilai, "A") == 0 || strcmp(nilai, "a") == 0)
nil += (3.75*n_sks);
else if (strcmp(nilai, "B+") == 0 || strcmp(nilai, "b+") == 0)
nil += (3.5*n_sks);
else if (strcmp(nilai, "B") == 0 || strcmp(nilai, "b") == 0)
nil += (3*n_sks);
else if (strcmp(nilai, "C+") == 0 || strcmp(nilai, "c+") == 0)
nil += (2.25*n_sks);
else if (strcmp(nilai, "C") == 0 || strcmp(nilai, "c") == 0)
nil += (2*n_sks);
else if (strcmp(nilai, "D+") == 0 || strcmp(nilai, "d+") == 0)
nil += (1.25*n_sks);
else if (strcmp(nilai, "D") == 0 || strcmp(nilai, "d") == 0)
nil += (1*n_sks);
else 
nil += (0.25*n_sks);
t_sks += n_sks; // (t_sks = t_sks + n_sks)
cin.getline(c,1);
}

//hitung ips
ips = nil/t_sks; 

cout << "\n Indeks Prestasi(IP) anda Semester ini adalah " << ips <<endl;
cout << endl;
system("pause");
return 0;
}
=======================================================================

TUTORIAL VIDEO DAPAT DI LIHAT DI 

Sekian posting dari saya, semiga bermanfaat yak, semangat belajar! :)



Minggu, 03 November 2013

PROGRAM SEDERHANA INSERT-DELETE-SEARCH MENGGUNAKAN BAHASA C

 Asalamualikum wr wb
Pada posting kali ini saya dan teman teman belajar mengenai bahasa C dimana belajar dengan penggunakan rekursif, linked list, sorting, dan seraching. Berikut adalah progam sederhanayang berisi menyimpan, mengapus, dan mencari data berupa NIM/ number yang telah di inputkan, Hasilnya sebagai berikut :



SOURCE CODE
==========================================================================
#include <stdio.h>
#include <stdlib.h>

struct DATA {
 int number;
 struct DATA *next;
};

int  cari(struct DATA *pList, int num);
void simpan(struct DATA *pList, int num);
void tampil(struct DATA *pList);
void hapus(struct DATA *pList, int num);

int main(void) {
 int num = 0;
 int i = 1;
 int r = 0;
 struct DATA *pList;
   
 pList = (struct DATA *)malloc(sizeof(struct DATA));
 pList->number = 0;
 pList->next = NULL;
   
 while(i != 0) {
  printf("\n-- Manajamen data NIM Mahasiswa --\n");
  
  printf("1 > Simpan\n");
  printf("2 > Hapus\n");
  printf("3 > Cari\n");
  printf("4 > Tampil\n");
  printf("0 > Exit\n");
  printf("\nPilih menu ? ");
  scanf("%d", &i);

  switch(i) {
   case 0: 
   default:
    printf("Terima Kasih..\n");
    i = 0;
    break;
   case 1:
    printf("== Simpan == \n");
    printf("Masukan NIM : ");
    scanf("%d", &num);
    simpan(pList, num);
    break;
   case 2:
    printf("== Hapus ==\n");
    printf("NIM yang di hapus: ");
    scanf("%d", &num);
    hapus(pList, num);
    break;
     case 3:
    printf("== Cari ==\n");
    printf("Masukan NIM untuk di cari: ");
    scanf("%d", &num);
    if((r = cari(pList, num)) == -1)
     printf("NIM `%d' tidak ditemukan\n", num);
    else
     printf("NIM `%d' barapa di posisi `%d'\n", num, r);
    break;
   case 4:
    printf("== Display =='\n");
    tampil(pList);
    break;
   }
  } 

 free(pList);
 system("pause");
 return(0);
}

void tampil(struct DATA *pList) {
 while(pList->next != NULL) {
  printf("%d \n", pList->number);
  pList = pList->next;
 }

 printf("%d \n", pList->number);
}

void simpan(struct DATA *pList, int num) {
 while(pList->next != NULL)
  pList = pList->next;

 pList->next = (struct DATA *)malloc(sizeof(struct DATA));
 pList->next->number = num;
 pList->next->next = NULL;
}

void hapus(struct DATA *pList, int num) {
 struct DATA *temp;
 temp = (struct DATA *)malloc(sizeof(struct DATA));

 if(pList->number == num) {

  temp = pList->next;
  free(pList);
  pList = temp;
 } else {
  while(pList->next->number != num)
   pList = pList->next;

  temp = pList->next->next;
  free(pList->next);
  pList->next = temp;
 }   
}
int cari(struct DATA *pList, int num) {
 int r = -1;
 int i = 1;

 while(pList->next != NULL) {
  if(pList->next->number == num)
   return i;
  else
   i++;

  pList = pList->next;
 }

 return r;
}
==========================================================================
FLOWCHART

 

VIDEO TUTORIAL : http://youtu.be/e6240l_9H4A