Operator Logika di C++ (VS2010)

Operator logika biasanya digunakan untuk melakukan pengecekan suatu kondisi pada pemrograman c++.

Operator logika hanya menghasilkan 2 nilai yaitu true(1) atau false(0).

berikut adalah video tutorial penggunaan operator logika di c++.

 

Dan Berikut adalah source code yang digunakan dalam video tersebut.

// modul4-2.cpp : Defines the entry point for the console application.
/* Operator Logika
Nama  :  Wayan Widya artana
NRP   : 49013035
*/

#include “stdafx.h”
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
cout<<“OPERASI OPERATOR LOGIKA”<<endl;

cout<<“Tabel Kebenaran operator AND”<<endl;
cout<<“1 && 1 = “<<(1 && 1)<<endl;
cout<<“1 && 0 = “<<(1 && 0)<<endl;
cout<<“0 && 1 = “<<(0 && 1)<<endl;
cout<<“0 && 0 = “<<(0 && 0)<<endl;

cout<<“Tabel Kebenaran operator OR”<<endl;
cout<<“1 || 1 = “<<(1 || 1)<<endl;
cout<<“1 || 0 = “<<(1 || 0)<<endl;
cout<<“0 || 1 = “<<(0 || 1)<<endl;
cout<<“0 || 0 = “<<(0 || 0)<<endl;

cout<<“Tabel Kebenaran operator NOT”<<endl;
cout<<“!1 = “<<(!1)<<endl;
cout<<“!0 = “<<(!0)<<endl;

return 0;
}

 


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s