code c++ gerbang logika
ada yang butuh coding c++ buat ngerjain tugas informatika anda, saya bagi disini source code tabel kebenaran gerbang logika
#include <iostream.h>
#include <iomanip.h>
#include <stdio.h>
#include <conio.h>
void main()
{
int x, p[4], q[4] , a[4], b[4], c[4], d[4] ;
p[0]=1;
p[1]=1;
p[2]=0;
p[3]=0;
q[0]=1;
q[1]=0;
q[2]=1;
q[3]=0;
cout<<"TABEL KEBENARAN\n";
cout<<"===============\n\n";
cout<<"-----------------------------------------------------------\n";
cout<<"P"<<setw(11)<<"Q"<<setw(13)<<"P OR Q"<<setw(12);
cout<<"P AND Q"<<setw(11)<<"P NOT Q"<<setw(12)<<"P XOR Q\n";
cout<<"-----------------------------------------------------------\n";
for (x=0; x<=3; x++)
{
a[x]=p[x]||q[x];
b[x]=p[x]&&q[x];
c[x]=!p[x];
d[x]=p[x]^q[x];
cout<<setiosflags(ios::left)<<setw(11)<<p[x];
cout<<setw(11)<<q[x];
cout<<setw(11)<<a[x];
cout<<setw(11)<<b[x];
cout<<setw(11)<<c[x];
cout<<setw(11)<<d[x];
cout<<endl;
}
cout<<endl;
getche();
}
nah semoga bermanfaat untuk nusa dan bangsa dan juga negara,salam sukses dari saya ikuti terus ragam posting ya sobat
#include <iostream.h>
#include <iomanip.h>
#include <stdio.h>
#include <conio.h>
void main()
{
int x, p[4], q[4] , a[4], b[4], c[4], d[4] ;
p[0]=1;
p[1]=1;
p[2]=0;
p[3]=0;
q[0]=1;
q[1]=0;
q[2]=1;
q[3]=0;
cout<<"TABEL KEBENARAN\n";
cout<<"===============\n\n";
cout<<"-----------------------------------------------------------\n";
cout<<"P"<<setw(11)<<"Q"<<setw(13)<<"P OR Q"<<setw(12);
cout<<"P AND Q"<<setw(11)<<"P NOT Q"<<setw(12)<<"P XOR Q\n";
cout<<"-----------------------------------------------------------\n";
for (x=0; x<=3; x++)
{
a[x]=p[x]||q[x];
b[x]=p[x]&&q[x];
c[x]=!p[x];
d[x]=p[x]^q[x];
cout<<setiosflags(ios::left)<<setw(11)<<p[x];
cout<<setw(11)<<q[x];
cout<<setw(11)<<a[x];
cout<<setw(11)<<b[x];
cout<<setw(11)<<c[x];
cout<<setw(11)<<d[x];
cout<<endl;
}
cout<<endl;
getche();
}
nah semoga bermanfaat untuk nusa dan bangsa dan juga negara,salam sukses dari saya ikuti terus ragam posting ya sobat
Nice posting gan..
ReplyDeleteMampir balik kunjungannya..
http://jagoposting.blogspot.com