[Type the company name] | [Type the company address]
PROGRAM DASAR SISTEM DIGITAL VERSI 1.0
LAPORAN
diajukan memenuhi tugas mata kuliah Dasar Komputer
Diploma IV Program Studi Teknik Elektronika
disusun oleh
Muchammad Fakhruzzaman Al Faisal
101354023
JURUSAN TEKNIK ELEKTRO
POLITEKNIK NEGERI BANDUNG
2011
[Type the company name] | [Type the company address]
TUJUAN
Tujuan dibuatnya program “program dasar sistem digital versi 1.0” selain
sebagai syarat dalam menyelesaikan tugas akhir mata kuliah dasar komputer pada
semester II adalah sebagai berikut:
· Mempermudah pengguna program untuk mempelajari dasar-dasar sistem digital
diantaranya konversi bilangan, pemahaman gerbang logika, dan pengetahuan
tentang IC logic seri-74xx.
· Mempercepat pencarian jenis IC seri/tipe 74xx yang sering digunakan bagi para
mahasiswa jurusan elektro pada umumnya dan mahasiswa program studi
elektronika pada khususnya.
· Mengaplikasikan serta mengkombinasikan materi-materi yang telah didapat
kedalam satu program.
· Sebagai wadah bagi penulis(programmer program ini) untuk mengembangkan
kemampuan dalam pemprograman, khususnya dalam pemprograman c/c++.
STRUKTUR PROGRAM
HEADER:
#include <conio.h>
#include <windows.h>
#include <iostream>
Penjelasan singkat:
· File header <conio.h> untuk menggunakan syntax ‘getch()’ dll.
· File header <windows.h> untuk menggunakan fungsi graphic dll. Contoh
dalam program ini untuk menggunakan syntax HANDLE, hConsole,
SetConsoleTextAttribute.
· File header <iostream> untuk menggunakan syantax cout, cin fungsi-fungsi
input-output format c++.
FUNGSI ‘Void’
Dalam program terdapat beberapa fungsi void diantaranya ;
Int main()
= fungsi utama program.
Void dectobin()
= fungsi untuk konversi desimal ke biner.
Void dectooctal()
= fungsi untuk kenversi desimal ke octal.
Void dectohex()
= fungsi untuk konversi desimal ke hexa.
Void buf()
= fungsi untuk gerbang buffer.
Void notgate()
= fungsi untuk gerbang not.
Void andgate( )
= fungsi untuk gerbang and.
Void orgate()
= fungsi untuk gerbang or.
Void nandgate()
= fungsi untuk gerbang nand.
[Type the company name] | [Type the company address]
Void norgate()
= fungsi untuk gerbang nor.
Void xorgate()
= fungsi untuk gerbang xor.
Void xnorgate()
= fungsi untuk gerbang xnor.
Void ic74xx()
= fungsi untuk pencari jenis ic seri-74xx.
Void konversi()
= fungsi penampung fungsi-fungsi konversi.
Void gate()
= fungsi penampung fungsi-fungsi gerbang.
Void tentang()
= fungsi untuk menampilkan tentang program.
Bagan Sistem Program Dasar Sistem Digital Versi 1.0
Menu utama
1.konversi bilangan
2.gerbang logika
3.IC-74xx
4.tentang program
5.keluar program
Pilih menu
Menu Konversi Bilangan 1.konversi desimal ke biner 2.konversi desima ke octal 3.konversi desimal ke hexa 4.keluar Menu Gerbang logika 1.buffer 2. Not 3.and 4.or 5.nand 6.nor7.xor 8.xnor 9.keluar
(Tampilan) IC-74xx Pencari jenis IC : Cari : Tentang program Program Konversi desimal ke biner
Program Konversi desimal ke biner
Program Konversi desimal ke biner
Input 1 Input 2 Input 3 Input 4
1 1 1 buffer 1 not 2 and 3 or 4 nand 5 nor 6 xor 7 xnor 8
Keluar Program
1 kembali ke submenu 0 keluar1 kembali ke
submenu 0 keluar
1 kembali ke submenu 0 keluar
Submenu
Program
4 5Keluar Program
Keluar Program Input 5[Type the company name] | [Type the company address]
FLOWCHART
Program menu-utama
[Type the company name] | [Type the company address]
SOURCE CODE
/*
Name : Program Dasar Sistem Digital Ver.1.0 Copyright : ical instrument@2011
Author : Muchammad Fakhruzzaman Al Faisal Date : 06/07/11 00:00
Description : terdiri dari;
1.program konversi bilangan 2.program gerbang logika 3.program pencari IC-74xx total line program : 888 line
*/ /*HEADER*/ #include <conio.h> #include <windows.h> #include <iostream> /*----*/ /*deklarasi fungsi*/ using namespace std;
/* awal subrutin desimal ke biner*/ void dectobin()
{
int num;
int a[20],b[20],i,j,k;
cout<<"Masukan bilangan desimal :"; cin>>num;
cout<<"Hasil konversi ke biner :"; i=0; while(num>0) { a[i]=num%2; i++; num=num/2; } k=i-1; for(j=0;j<i;j++) { b[j]=a[k]; k--; } for(j=0;j<i;j++) { cout<<b[j]; } } /*----*/
/* awal subrutin konversi desimal ke octal*/ void dectooctal()
{
int n,r[10],i;
cout<<"Masukan bilangan desimal : "; cin>>n;
cout<<"Hasil konversi ke octal : "; for(i=0;n!=0;i++) { r[i]=n%8; n=n/8; } i--; for(;i>=0;i--) cout<<r[i]; } /*----*/ (1)
/* awal subrutin konversi desimal ke hexa*/ void dectohex()
{
int n;
cout<<"Masukan bilangan desimal :"; cin>>n;
cout<<"Hasil konversi ke hexa :"; {
for (int i=2*sizeof(int) - 1; i>=0; {
cout << "0123456789ABCDEF"[((n >> i*4) & 0xF)]; }
} }
/*----*/
/*subrutin tentang program*/ void tentang()
{
HANDLE hConsole;
hConsole = GetStdHandle (STD_OUTPUT_HANDLE); SetConsoleTextAttribute
(hConsole, FOREGROUND_RED | FOREGROUND_RED); cout<<"\n|Program Dasar Sistem Digital Ver 1.0 |"; hConsole = GetStdHandle (STD_OUTPUT_HANDLE); SetConsoleTextAttribute
(hConsole, FOREGROUND_RED | FOREGROUND_GREEN); cout<<"\n| M.Fakhruzzaman.Al.Faisal |"; cout<<"\n| 101354023 |"; hConsole = GetStdHandle (STD_OUTPUT_HANDLE); SetConsoleTextAttribute
(hConsole, FOREGROUND_BLUE | FOREGROUND_BLUE); cout<<"\n| D4 Elektronika |"; cout<<"\n| Teknik Elektronika |"; cout<<"\n| Politeknik Negeri Bandung |"; cout<<"\n| 2011 hConsole = GetStdHandle (STD_OUTPUT_HANDLE); SetConsoleTextAttribute
(hConsole, FOREGROUND_GREEN | FOREGROUND_GREEN); cout<<"\n|---} /*----*/ /*buffer*/ void buf() { int i,x; cout<<"\nbuffer"; cout<<"\n---"; cout<<"\ninput :"; cin>>i; cout<<"\noutput:"; cout<<i; } /*not*/ void notgate() { int i,x; cout<<"\nnot"; cout<<"\n---"; cout<<"\ninput :"; cin>>i; if (i==1) { cout<<"\noutput:0"; } else if(i==0) { cout<<"\noutput:1"; } else {
cout<<"\ninput biner 1 atau 0!"; }
}
[Type the company name] | [Type the company address]
...
TUJUAN
Tujuan dibuatnya program “program dasar sistem digital versi 1.0” selain
sebagai syarat dalam menyelesaikan tugas akhir mata kuliah dasar komputer pada
semester II adalah sebagai berikut:
· Mempermudah pengguna program untuk mempelajari dasar-dasar sistem digital
diantaranya konversi bilangan, pemahaman gerbang logika, dan pengetahuan
tentang IC logic seri-74xx.
· Mempercepat pencarian jenis IC seri/tipe 74xx yang sering digunakan bagi para
mahasiswa jurusan elektro pada umumnya dan mahasiswa program studi
elektronika pada khususnya.
· Mengaplikasikan serta mengkombinasikan materi-materi yang telah didapat
kedalam satu program.
· Sebagai wadah bagi penulis(programmer program ini) untuk mengembangkan
kemampuan dalam pemprograman, khususnya dalam pemprograman c/c++.
STRUKTUR PROGRAM
HEADER:
#include <conio.h>
#include <windows.h>
#include <iostream>
Penjelasan singkat:
· File header <conio.h> untuk menggunakan syntax ‘getch()’ dll.
· File header <windows.h> untuk menggunakan fungsi graphic dll. Contoh
dalam program ini untuk menggunakan syntax HANDLE, hConsole,
SetConsoleTextAttribute.
· File header <iostream> untuk menggunakan syantax cout, cin fungsi-fungsi
input-output format c++.
FUNGSI ‘Void’
Dalam program terdapat beberapa fungsi void diantaranya ;
Int main()
= fungsi utama program.
Void dectobin()
= fungsi untuk konversi desimal ke biner.
Void dectooctal()
= fungsi untuk kenversi desimal ke octal.
Void dectohex()
= fungsi untuk konversi desimal ke hexa.
Void buf()
= fungsi untuk gerbang buffer.
Void notgate()
= fungsi untuk gerbang not.
PROGRAM DASAR SISTEM DIGITAL VERSI 1.0
LAPORAN
diajukan memenuhi tugas mata kuliah Dasar Komputer
Diploma IV Program Studi Teknik Elektronika
disusun oleh
Muchammad Fakhruzzaman Al Faisal
101354023
JURUSAN TEKNIK ELEKTRO
POLITEKNIK NEGERI BANDUNG
2011
[Type the company name] | [Type the company address]
Void andgate( )
= fungsi untuk gerbang and.
Void orgate()
= fungsi untuk gerbang or.
Void nandgate()
= fungsi untuk gerbang nand.
Void norgate()
= fungsi untuk gerbang nor.
Void xorgate()
= fungsi untuk gerbang xor.
Void xnorgate()
= fungsi untuk gerbang xnor.
Void ic74xx()
= fungsi untuk pencari jenis ic seri-74xx.
Void konversi()
= fungsi penampung fungsi-fungsi konversi.
Void gate()
= fungsi penampung fungsi-fungsi gerbang.
Void tentang()
= fungsi untuk menampilkan tentang program.
Bagan Sistem Program Dasar Sistem Digital Versi 1.0
FLOWCHART
Program menu-utama
`
Menu utama
1.konversi bilangan
2.gerbang logika
3.IC-74xx
4.tentang program
5.keluar program
Pilih menu
Menu Konversi Bilangan 1.konversi desimal ke biner 2.konversi desima ke octal 3.konversi desimal ke hexa 4.keluar Menu Gerbang logika 1.buffer 2. Not 3.and 4.or 5.nand 6.nor7.xor 8.xnor 9.keluar
(Tampilan) IC-74xx Pencari jenis IC : Cari : Tentang program Program Konversi desimal ke biner
Program Konversi desimal ke biner
Program Konversi desimal ke biner
Input 1 Input 2 Input 3 Input 4
1 1 1 buffer 1 not 2 and 3 or 4 nand 5 nor 6 xor 7 xnor 8
Keluar Program
1 kembali ke submenu 0 keluar1 kembali ke
submenu 0 keluar
1 kembali ke submenu 0 keluar
Submenu
Program
4 5Keluar Program
Keluar Program Input 5[Type the company name] | [Type the company address]
SOURCE CODE
...
The using software is free version, you can upgrade it to the upgrade
version.http://www.allimagetool.com
/*and*/ void andgate() { int a,b,x; cout<<"\nand"; cout<<"\n---"; cout<<"\ninput a:"; cin>>a; cout<<"\ninput b:"; cin>>b; if (a==0 && b==0) { cout<<"\noutput :0"; }else if(a==0 && b==1) {
cout<<"\noutput :0"; }
else if(a==1 && b==0) {
cout<<"\noutput :0"; }
else if(a==1 && b==1) {
cout<<"\noutput :1"; }
else {
cout<<"\noutput error ! input harus 1 atau 0!"; } } /*or*/ void orgate() { int a,b,x; cout<<"\nor"; cout<<"\n---"; cout<<"\ninput a:"; cin>>a; cout<<"\ninput b:"; cin>>b; if (a==0 && b==0) /*nand*/ void nandgate() { int a,b,x; cout<<"\nnand"; cout<<"\n---"; cout<<"\ninput a:"; cin>>a; cout<<"\ninput b:"; cin>>b; if (a==0 && b==0) { cout<<"\noutput :1"; }
else if(a==0 && b==1) {
cout<<"\noutput :1"; }
else if(a==1 && b==0) {
cout<<"\noutput :1"; }
else if(a==1 && b==1) {
cout<<"\noutput :0"; }
else {
cout<<"\noutput error ! input harus 1 atau 0!"; } } /*nor*/ void norgate() { int a,b,x; cout<<"\nnor"; cout<<"\n---"; cout<<"\ninput a:"; cin>>a; cout<<"\ninput b:"; cin>>b; if (a==0 && b==0) /*
Name : Program Dasar Sistem Digital Ver.1.0 Copyright : ical instrument@2011
Author : Muchammad Fakhruzzaman Al Faisal Date : 06/07/11 00:00
Description : terdiri dari;
1.program konversi bilangan 2.program gerbang logika 3.program pencari IC-74xx total line program : 888 line
*/ /*HEADER*/ #include <conio.h> #include <windows.h> #include <iostream> /*----*/ /*deklarasi fungsi*/ using namespace std;
/* awal subrutin desimal ke biner*/ void dectobin()
{
int num;
int a[20],b[20],i,j,k;
cout<<"Masukan bilangan desimal :"; cin>>num;
cout<<"Hasil konversi ke biner :"; i=0; while(num>0) { a[i]=num%2; i++; num=num/2; } k=i-1; for(j=0;j<i;j++) { b[j]=a[k]; k--; } for(j=0;j<i;j++) { cout<<b[j]; } } /*----*/
/* awal subrutin konversi desimal ke octal*/ void dectooctal()
{
int n,r[10],i;
cout<<"Masukan bilangan desimal : "; cin>>n;
cout<<"Hasil konversi ke octal : "; for(i=0;n!=0;i++) { r[i]=n%8; n=n/8; } i--; for(;i>=0;i--) cout<<r[i]; }
/* awal subrutin konversi desimal ke hexa*/ void dectohex()
{
int n;
cout<<"Masukan bilangan desimal :"; cin>>n;
cout<<"Hasil konversi ke hexa :"; {
for (int i=2*sizeof(int) - 1; i>=0; {
cout << "0123456789ABCDEF"[((n >> i*4) & 0xF)]; }
} }
/*----*/
/*subrutin tentang program*/ void tentang()
{
HANDLE hConsole;
hConsole = GetStdHandle (STD_OUTPUT_HANDLE); SetConsoleTextAttribute
(hConsole, FOREGROUND_RED | FOREGROUND_RED); cout<<"\n|Program Dasar Sistem Digital Ver 1.0 |"; hConsole = GetStdHandle (STD_OUTPUT_HANDLE); SetConsoleTextAttribute
(hConsole, FOREGROUND_RED | FOREGROUND_GREEN); cout<<"\n| M.Fakhruzzaman.Al.Faisal |"; cout<<"\n| 101354023 |" hConsole = GetStdHandle (STD_OUTPUT_HANDLE); SetConsoleTextAttribute
(hConsole, FOREGROUND_BLUE | FOREGROUND_BLUE); cout<<"\n| D4 Elektronika |"; cout<<"\n| Teknik Elektronika |"; cout<<"\n| Politeknik Negeri Bandung |"; cout<<"\n| 2011 |"; hConsole = GetStdHandle (STD_OUTPUT_HANDLE); SetConsoleTextAttribute
(hConsole, FOREGROUND_GREEN | FOREGROUND_GREEN); cout<<"\n|---} /*----*/ /*buffer*/ void buf() { int i,x; cout<<"\nbuffer"; cout<<"\n---"; cout<<"\ninput :"; cin>>i; cout<<"\noutput:"; cout<<i; } /*not*/ void notgate() { int i,x; cout<<"\nnot"; cout<<"\n---"; cout<<"\ninput :"; cin>>i; if (i==1) { cout<<"\noutput:0"; } else if(i==0)
[Type the company name] | [Type the company address]
/*xor*/ void xorgate() { int a,b,x; cout<<"\nxor"; cout<<"\n---"; cout<<"\ninput a:"; cin>>a; cout<<"\ninput b:"; cin>>b; if (a==0 && b==0) { cout<<"\noutput :0"; } else if(a==0 && b==1) { cout<<"\noutput :1"; } else if(a==1 && b==0) { cout<<"\noutput :1"; } else if(a==1 && b==1) { cout<<"\noutput :0"; } else { cout<<"\noutput error ! input harus 1 atau 0!"; } } /*xnor*/ void xnorgate() { int a,b,x; cout<<"\nxnor"; cout<<"\n---"; cout<<"\ninput a:"; cin>>a; cout<<"\ninput b:"; cin>>b; if (a==0 && b==0) { cout<<"\noutput :1"; } else if(a==0 && b==1) { cout<<"\noutput :0"; } else if(a==1 && b==0) { cout<<"\noutput :0"; } else if(a==1 && b==1) { cout<<"\noutput :1"; } else { cout<<"\noutput error ! input harus 1 atau 0!"; } } (5) /*gerbang logika*/ void gate() { menu: int p,y; cout<<"\n ____________________________________"; cout<<"\n|Program Dasar Sistem Digital Ver 1.0|"; cout<<"\n| Gerbang logika |";cout<<"\n|[1].buffer |"; cout<<"\n|[2].not |"; cout<<"\n|[3].and |"; cout<<"\n|[4].or cout<<"\n|[5].nand |"; cout<<"\n|[6].nor |"; cout<<"\n|[7].xor |"; cout<<"\n|[8].xnor |"; cout<<"\n|[9].keluar cout<<"\n|Pilih menu 1 s/d 9: |"; cout<<"\n|____________________________________|"; cin>>p; system("cls");
/* switch & case syntax*/ switch(p) { case 1: buf: buf(); getch();
cout<<"\nulangi program tekan 1, tekan 0 ke submenu :"; cin>>y; system("cls"); if (y==1) { goto buf; } else if(y==0) { goto menu; } else { cout<<"\nTekan 1 atau 0 !"; } break; case 2: notgate: notgate(); getch();
cout<<"\nulangi program tekan 1, tekan 0 ke submenu :"; cin>>y; system("cls"); if (y==1) { goto notgate; } else if(y==0) { goto menu; } else { cout<<"\nTekan 1 atau 0 !"; } break; (6)
[Type the company name] | [Type the company address]
case 3:andgate: andgate(); getch();
cout<<"\nulangi program tekan 1, tekan 0 ke-submenu :"; cin>>y; system("cls"); if (y==1) { goto andgate; } else if(y==0) { goto menu; } else { cout<<"\nTekan 1 atau 0 !"; } break; case 4: orgate: orgate(); getch();
cout<<"\nulangi program tekan 1, tekan 0 ke-submenu :"; cin>>y; system("cls"); if (y==1) { goto orgate; } else if(y==0) { goto menu; } else { cout<<"\nTekan 1 atau 0 !"; } break; case 5: nandgate: nandgate(); getch();
cout<<"\nulangi program tekan 1, tekan 0 ke-submenu :"; cin>>y; system("cls"); if (y==1) { goto nandgate; } else if(y==0) { goto menu; } else { cout<<"\nTekan 1 atau 0 !"; } break; (7) case 6: norgate: norgate(); getch();
cout<<"\nulangi program tekan 1, tekan 0 ke submenu :"; cin>>y; system("cls"); if (y==1) { goto norgate; } else if(y==0) { goto menu; } else { cout<<"\nTekan 1 atau 0 !"; } break; case 7: xorgate: xorgate(); getch();
cout<<"\nulangi program tekan 1, tekan 0 ke submenu :"; cin>>y; system("cls"); if (y==1) { goto xorgate; } else if(y==0) { goto menu; } else { cout<<"\nTekan 1 atau 0 !"; } break; case 8: xnorgate: xnorgate(); getch();
cout<<"\nulangi program tekan 1, tekan 0 ke submenu :"; cin>>y; system("cls"); if (y==1) { goto xnorgate; } else if(y==0) { goto menu; } else { cout<<"\nTekan 1 atau 0 !"; } break; case 9: cout<<"\n"; break; default:
cout<<"input yang dimasukan tidak tersedia !"; break; } } /*----*/ (8)
[Type the company name] | [Type the company address]
/*konversi*/ void konversi() { int p,y; menu: cout<<"\n ____________________________________"; cout<<"\n|Program Dasar Sistem Digital Ver 1.0|"; cout<<"\n| Konversi Bilangan |"; cout<<"\n|---|"; cout<<"\n|[1].Konversi desimal ke biner |"; cout<<"\n|[2].Konversi desimal ke octal |"; cout<<"\n|[3].Konversi desimal ke hexa |"; cout<<"\n|[4].Keluar |"; cout<<"\n|---|"; cout<<"\n|Pilih menu konversi diatas = |"; cout<<"\n|____________________________________|"; cin>>p;system("cls");
/* switch & case syntax*/ switch(p) { case 1: dectobin: dectobin(); getch();
cout<<"\nulangi program tekan 1, tekan 0 ke-submenu :"; cin>>y; system("cls"); if (y==1) { goto dectobin; } else if(y==0) { goto menu; } else { cout<<"\nTekan 1 atau 0 !"; } break; case 2: dectooct: dectooctal(); getch();
cout<<"\nulangi program tekan 1, tekan 0 ke-submenu :"; cin>>y; system("cls"); if (y==1) { goto dectooct; } else if(y==0) { goto menu; } else { cout<<"\nTekan 1 atau 0 !"; } break; (9) case 3: dectohex: dectohex(); getch();
cout<<"\nulangi program tekan 1, tekan 0 ke submenu :"; cin>>y; system("cls"); if (y==1) { goto dectohex; } else if(y==0) { goto menu; } else { cout<<"\nTekan 1 atau 0 !"; } break; case 4: cout<<"\n"; break; default:
cout<<"input yang dimasukan tidak tersedia !"; break; } } /*IC 74xx*/ void ic74xx() { int ic; cout<<"\nPencari jenis IC seri-74xx cout<<"\nCari:";
cin>>ic; if (ic==7400) {
cout<<"\nquad 2-input nand gate"; }
else if (ic==7402) {
cout<<"\nquad 2-input nor gate"; }
else if (ic==7403) {
cout<<"\nquad 2-input open drain nand gate"; } else if (ic==7404) { cout<<"\nhex inverter"; } else if (ic==7405) {
cout<<"\nhex inverter buffer"; } else if (ic==7406) { cout<<"\n"; } else if (ic==7407) {
cout<<"\nhex buffer(open drain)"; }
else if (ic==7408) {
cout<<"\nquad 2-input and gate"; }
else if (ic==7410) {
cout<<"\ntriple 3-input nand gate"; }
[Type the company name] | [Type the company address]
else if (ic==7411){
cout<<"\ntriple 3-input and gate"; }
else if (ic==7412) {
cout<<"\ntriple 3-input positive nand"; }
else if (ic==7413) {
cout<<"\ndual 4-input positive nand schmitt triggers";
}
else if (ic==7414) {
cout<<"\nhex schmitt inverter"; } else if (ic==7417) { cout<<"\nhex buffer"; } else if (ic==7420) {
cout<<"\ndual 4-input nand gate"; }
else if (ic==7421) {
cout<<"\ndual 4-input and gate"; }
else if (ic==7427) {
cout<<"\ntriple 3-input nor gate"; }
else if (ic==7428) {
cout<<"\nquadruple 2-input positive nor buffers"; }
else if (ic==7430) {
cout<<"\n8 input nand gate"; }
else if (ic==7432) {
cout<<"\nquad 2-input or gate"; }
else if (ic==7438) {
cout<<"\nquadruple 2-input positive-nand buffer"; }
else if (ic==7442) {
cout<<"\nbcd to decimal decoder"; }
else if (ic==7447) {
cout<<"\nbcd to seven segment decoder"; }
else if (ic==7473) {
cout<<"\ndual j-k flip-flop with preset and clear"; }
else if (ic==7474) {
cout<<"\ndual d type flip-flop with preset & clear"; }
(11)
else if (ic==7475) {
cout<<"\n4 bit d type latch"; }
else if (ic==7485) {
cout<<"\n4bit magnitude comparator"; }
else if (ic==7486) {
cout<<"\nquad exclusive or gate"; } else { cout<<"\nbelum tersedia..."; } cout<<"\n---"; getch(); } /*----*/
/* awal menu utama */ int main()
{
/* main syntax textcolor */ HANDLE hConsole;
hConsole = GetStdHandle (STD_OUTPUT_HANDLE); /*variable*/
int p,k,y; /*label*/ menu:
SetConsoleTextAttribute
(hConsole, FOREGROUND_RED | FOREGROUND_RED); cout<<"\n ____________________________________"; cout<<"\n|Program Dasar Sistem Digital Ver cout<<"\n| ical-instrument@2011 |"; cout<<"\n|____________________________________|"; SetConsoleTextAttribute
(hConsole, FOREGROUND_RED | FOREGROUND_GREEN); cout<<"\n|[1].Konversi bilangan |"; SetConsoleTextAttribute
(hConsole, FOREGROUND_RED | FOREGROUND_GREEN); cout<<"\n|[2].Gerbang logika |"; SetConsoleTextAttribute
(hConsole, FOREGROUND_RED | FOREGROUND_GREEN); cout<<"\n|[3].IC-74xx SetConsoleTextAttribute
(hConsole, FOREGROUND_RED | FOREGROUND_GREEN); cout<<"\n|[4].Tentang program |"; SetConsoleTextAttribute
(hConsole, FOREGROUND_RED | FOREGROUND_GREEN); cout<<"\n|[5].Keluar program |"; SetConsoleTextAttribute
(hConsole, FOREGROUND_GREEN | FOREGROUND_GREEN); cout<<"\n|Pilih menu diatas = |"; cout<<"\n|____________________________________|"; cin>>p;
system("cls");
/* switch & case syntax*/ switch(p) { case 1: konversi(); break; case 2: gate(); break; (12)
[Type the company name] | [Type the company address]
case 3:ic74xx: ic74xx();
cout<<"\ntekan 1 untuk mengulang, tekan 0 untuk ke-menu:"; cin>>y; system("cls"); if (y==1) { goto ic74xx; } else if(y==0) { goto menu; } else {
cout<<"\n Tekan 1 atau 0 !"; goto konfirmasi; } break; case 4: tentang: tentang(); getch();
cout<<"\nkembali ke-menu tekan 1, keluar program tekan 0 :"; cin>>y; system("cls"); if (y==1) { goto menu; } else if(y==0) { return 0; } else {
cout<<"\n Tekan 1 atau 0 !"; goto konfirmasi; } break; case 5: return 0; break; default:
cout<<"input yang dimasukan tidak tersedia !"; break; } /*----*/ /* konfirmasi */ konfirmasi:
cout<<"\nTekan 1 kembali ke-menu,0 keluar program. "; cin>>k; system("cls"); if (k==1) { goto menu; } else if (k==0) { return 0; } else {
cout<<"Maaf tekan 1 atau 0...!!!"; goto konfirmasi;
}
getch(); }