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
Tidak ada komentar:
Posting Komentar