c++ part 5 : menu d'resto
back to blognya el *senyum paling manis*
el mau posting tentang coding program yang el bikin buat tugas temen el nih.. hehhehe...
jadi ini tuh programnya tentang bikin tampilan menu buat rumah makan gitu. oke deeh langsung cuuus aja deh yaak..
berikut ini codingan super panjangnya niih..
#include <stdio.h>
#include <conio.h>
#include <windows.h>
int pilih,lagi,jumlah;
float total;
void awal();
void makan();
void minum();
void selesai();:Yb
void daftar();
void gotoxy(int x, int y);
main ()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
SetConsoleTextAttribute ( h, BACKGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY );
awal();
getch();
return 0;
}
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void selesai()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
SetConsoleTextAttribute ( h, BACKGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY );
system("cls");
gotoxy(12,10);
printf("*TERIMA KASIH TELAH DATANG DAN MEMESAN MENU DI SSA D'RESTO*\n");
gotoxy(22,13);
printf("^^ MOHON TUNGGU PESANANNYA YAA ^^");
}
void awal()
{
system("cls");
gotoxy(27,5);printf("WELCOME");
gotoxy(24,7);printf("SELAMAT DATANG");
gotoxy(29,9);printf("DI");
gotoxy(24,11);printf("^ SSA D'RESTO ^");
gotoxy(20,12);printf("=======================");
gotoxy(20,13);printf("1. LIHAT MENU MAKANAN");
gotoxy(20,14);printf("2. LIHAT MENU MINUMAN");
gotoxy(20,15);printf("3. KELUAR ");
gotoxy(20,17);printf("MASUKKAN NOMER PILIHAN ANDA");
gotoxy(20,18);printf("PILIH >> ");scanf("%d",&pilih);
if (pilih==1) {makan();}
else if (pilih==2) {minum();}
else if (pilih==3) {selesai();}
else{awal();}
}
void makan()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
SetConsoleTextAttribute ( h, FOREGROUND_GREEN | FOREGROUND_INTENSITY );
system("cls");
gotoxy(20,3);printf("MENU MAKANAN");
gotoxy(15,5);printf("===================================================");
gotoxy(15,6);printf("1. NASI GORENG SPESIAL RP 20.000,00");
gotoxy(15,7);printf("2. BEEF STEAK RP 55.000,00");
gotoxy(15,8);printf("3. KEPITING SAUS TIRAM RP 45.000,00");
gotoxy(15,9);printf("4. AYAM GORENG SAUS MENTEGA RP 38.000,00");
gotoxy(15,10);printf("5. KAKAP GORENG SAUS ASAM MANIS RP 52.000,00");
gotoxy(15,13);printf("MASUKKAN NOMER MENU MAKANAN ANDA [1-5] >> ");
scanf("%d",&pilih);
gotoxy(15,14);printf("MASUKKAN JUMLAH YANG DIPESAN >> ");
scanf("%d",&jumlah);
if (pilih==1)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> NASI GORENG SPESIAL");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=20000*jumlah);}
if (pilih==2)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> BEEF STEAK");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=55000*jumlah);}
if (pilih==3)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> KEPITING SAUS TIRAM");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=45000*jumlah);}
if (pilih==4)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> AYAM GORENG SAUS MENTEGA");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=38000*jumlah);}
if (pilih==5)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> KAKAP GORENG SAUS ASAM MANIS");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=52000*jumlah);}
gotoxy(15,19);printf("ADA LAGI YANG DI PESAN [Y/T] ? >> ");
scanf("%s",&lagi);
if (lagi=='Y' || lagi == 'y') {makan();}
else if (lagi == 'T' || lagi == 't')
{
gotoxy(15,21);printf("1. LIHAT MENU MINUMAN");
gotoxy(15,22);printf("2. SELESAI");
gotoxy(15,23);printf("MASUKKAN NOMER PILIHAN SELANJUTNYA >> ");
scanf("%d",&pilih);
if (pilih==1) {minum();}
else if (pilih==2) {selesai();}
else {makan();}
}
}
void minum()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
SetConsoleTextAttribute ( h, FOREGROUND_GREEN | FOREGROUND_INTENSITY );
system("cls");
gotoxy(20,3);printf("MENU MINUMAN");
gotoxy(15,5);printf("===================================================");
gotoxy(15,6);printf("1. SUP BUAH RP 13.000,00");
gotoxy(15,7);printf("2. JUS ALPUKAT RP 12.000,00");
gotoxy(15,8);printf("3. MILKSHAKE CAPUCINO RP 15.000,00");
gotoxy(15,9);printf("4. MILKSHAKE COKLAT RP 15.000,00");
gotoxy(15,10);printf("5. ES CAMPUR SPESIAL RP 20.000,00");
gotoxy(15,13);printf("MASUKKAN NOMER MENU MINUMAN ANDA [1-5] >> ");
scanf("%d",&pilih);
gotoxy(15,14);printf("MASUKKAN JUMLAH YANG DIPESAN >> ");
scanf("%d",&jumlah);
if (pilih==1)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> SUP BUAH");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=13000*jumlah);}
if (pilih==2)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> JUS ALPUKAT");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=12000*jumlah);}
if (pilih==3)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> MILKSHAKE CAPUCINO");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=15000*jumlah);}
if (pilih==4)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> MILKSHAKE COKLAT");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=15000*jumlah);}
if (pilih==5)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> ES CAMPUR SPESIAL");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=20000*jumlah);}
gotoxy(15,19);printf("ADA LAGI YANG DI PESAN [Y/T] ? >> ");
scanf("%s",&lagi);
if (lagi=='Y' || lagi == 'y') {minum();}
else if (lagi == 'T' || lagi == 't')
{
gotoxy(15,21);printf("1. LIHAT MENU MAKANAN");
gotoxy(15,22);printf("2. SELESAI");
gotoxy(15,23);printf("MASUKKAN NOMER PILIHAN SELANJUTNYA >> ");
scanf("%d",&pilih);
if (pilih==1) {makan();}
else if (pilih==2) {selesai();}
else {minum();}
}
}
naaah.. ini hasil outputnya :
el mau posting tentang coding program yang el bikin buat tugas temen el nih.. hehhehe...
jadi ini tuh programnya tentang bikin tampilan menu buat rumah makan gitu. oke deeh langsung cuuus aja deh yaak..
berikut ini codingan super panjangnya niih..
#include <stdio.h>
#include <conio.h>
#include <windows.h>
int pilih,lagi,jumlah;
float total;
void awal();
void makan();
void minum();
void selesai();:Yb
void daftar();
void gotoxy(int x, int y);
main ()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
SetConsoleTextAttribute ( h, BACKGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY );
awal();
getch();
return 0;
}
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void selesai()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
SetConsoleTextAttribute ( h, BACKGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY );
system("cls");
gotoxy(12,10);
printf("*TERIMA KASIH TELAH DATANG DAN MEMESAN MENU DI SSA D'RESTO*\n");
gotoxy(22,13);
printf("^^ MOHON TUNGGU PESANANNYA YAA ^^");
}
void awal()
{
system("cls");
gotoxy(27,5);printf("WELCOME");
gotoxy(24,7);printf("SELAMAT DATANG");
gotoxy(29,9);printf("DI");
gotoxy(24,11);printf("^ SSA D'RESTO ^");
gotoxy(20,12);printf("=======================");
gotoxy(20,13);printf("1. LIHAT MENU MAKANAN");
gotoxy(20,14);printf("2. LIHAT MENU MINUMAN");
gotoxy(20,15);printf("3. KELUAR ");
gotoxy(20,17);printf("MASUKKAN NOMER PILIHAN ANDA");
gotoxy(20,18);printf("PILIH >> ");scanf("%d",&pilih);
if (pilih==1) {makan();}
else if (pilih==2) {minum();}
else if (pilih==3) {selesai();}
else{awal();}
}
void makan()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
SetConsoleTextAttribute ( h, FOREGROUND_GREEN | FOREGROUND_INTENSITY );
system("cls");
gotoxy(20,3);printf("MENU MAKANAN");
gotoxy(15,5);printf("===================================================");
gotoxy(15,6);printf("1. NASI GORENG SPESIAL RP 20.000,00");
gotoxy(15,7);printf("2. BEEF STEAK RP 55.000,00");
gotoxy(15,8);printf("3. KEPITING SAUS TIRAM RP 45.000,00");
gotoxy(15,9);printf("4. AYAM GORENG SAUS MENTEGA RP 38.000,00");
gotoxy(15,10);printf("5. KAKAP GORENG SAUS ASAM MANIS RP 52.000,00");
gotoxy(15,13);printf("MASUKKAN NOMER MENU MAKANAN ANDA [1-5] >> ");
scanf("%d",&pilih);
gotoxy(15,14);printf("MASUKKAN JUMLAH YANG DIPESAN >> ");
scanf("%d",&jumlah);
if (pilih==1)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> NASI GORENG SPESIAL");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=20000*jumlah);}
if (pilih==2)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> BEEF STEAK");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=55000*jumlah);}
if (pilih==3)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> KEPITING SAUS TIRAM");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=45000*jumlah);}
if (pilih==4)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> AYAM GORENG SAUS MENTEGA");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=38000*jumlah);}
if (pilih==5)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> KAKAP GORENG SAUS ASAM MANIS");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=52000*jumlah);}
gotoxy(15,19);printf("ADA LAGI YANG DI PESAN [Y/T] ? >> ");
scanf("%s",&lagi);
if (lagi=='Y' || lagi == 'y') {makan();}
else if (lagi == 'T' || lagi == 't')
{
gotoxy(15,21);printf("1. LIHAT MENU MINUMAN");
gotoxy(15,22);printf("2. SELESAI");
gotoxy(15,23);printf("MASUKKAN NOMER PILIHAN SELANJUTNYA >> ");
scanf("%d",&pilih);
if (pilih==1) {minum();}
else if (pilih==2) {selesai();}
else {makan();}
}
}
void minum()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
SetConsoleTextAttribute ( h, FOREGROUND_GREEN | FOREGROUND_INTENSITY );
system("cls");
gotoxy(20,3);printf("MENU MINUMAN");
gotoxy(15,5);printf("===================================================");
gotoxy(15,6);printf("1. SUP BUAH RP 13.000,00");
gotoxy(15,7);printf("2. JUS ALPUKAT RP 12.000,00");
gotoxy(15,8);printf("3. MILKSHAKE CAPUCINO RP 15.000,00");
gotoxy(15,9);printf("4. MILKSHAKE COKLAT RP 15.000,00");
gotoxy(15,10);printf("5. ES CAMPUR SPESIAL RP 20.000,00");
gotoxy(15,13);printf("MASUKKAN NOMER MENU MINUMAN ANDA [1-5] >> ");
scanf("%d",&pilih);
gotoxy(15,14);printf("MASUKKAN JUMLAH YANG DIPESAN >> ");
scanf("%d",&jumlah);
if (pilih==1)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> SUP BUAH");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=13000*jumlah);}
if (pilih==2)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> JUS ALPUKAT");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=12000*jumlah);}
if (pilih==3)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> MILKSHAKE CAPUCINO");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=15000*jumlah);}
if (pilih==4)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> MILKSHAKE COKLAT");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=15000*jumlah);}
if (pilih==5)
{gotoxy(15,16);printf("MENU YANG DI PESAN >> ES CAMPUR SPESIAL");
gotoxy(15,17);printf("TOTAL HARGA >> RP %.2f",total=20000*jumlah);}
gotoxy(15,19);printf("ADA LAGI YANG DI PESAN [Y/T] ? >> ");
scanf("%s",&lagi);
if (lagi=='Y' || lagi == 'y') {minum();}
else if (lagi == 'T' || lagi == 't')
{
gotoxy(15,21);printf("1. LIHAT MENU MAKANAN");
gotoxy(15,22);printf("2. SELESAI");
gotoxy(15,23);printf("MASUKKAN NOMER PILIHAN SELANJUTNYA >> ");
scanf("%d",&pilih);
if (pilih==1) {makan();}
else if (pilih==2) {selesai();}
else {minum();}
}
}
naaah.. ini hasil outputnya :
tampilan awal |
menu makanan |
menu minuman |
menu keluar |
Komentar
Posting Komentar
Terima kasih sudah membaca postingan ini. Silahkan komentarnya