Bit Manipulation: Conditional Statement using Bit-wise operators with C++



How to Cite

Nafi’ah, R., Kurniawan, W., Setiawan, J., & Umam, K. (2020). Bit Manipulation: Conditional Statement using Bit-wise operators with C++. IJID (International Journal on Informatics for Development), 9(1), 9–14.


All of information that manipulated by a computer is represented in the form of bits, so in the programming language it is necessary to understand bitwise operations at the first. This paper aims to create a concept of making Conditional Statements with Bitwise operators in C ++. By doing so, we hope that people is easy to understand  the operation behind conditional statements. A conditional operator is also known as a ternary operator. It takes three operands. A conditional operator is closely related with if else statement. The method used is a literature study studying the bit manipulation algorithm in the C ++ language. The results obtained are a function using bitwise operations in C ++ that implement conditional statements.


F. Gulo, “Aplikasi Pembelajaran Hidrografi Menggunakan Metode Computer Assisted Instruction (CAI),” J. Ris. Komput., vol. Vol. 3 No., no. Desember, pp. 34–37, 2018.

Laudon, Management Information Systems Thirteenth Edition Global Edition. 2014.

S. Janakiraman, K. Thenmozhi, J. B. B. Rayappan, and R. Amirtharajan, “Lightweight chaotic image encryption algorithm for real-time embedded system: Implementation and analysis on 32-bit microcontroller,” Microprocess. Microsyst., vol. 56, pp. 1–12, 2018.

R. E. Bryant and D. R. O’Hallaron, Computer Systems : a Programmer’s Perspective -Second edition. 2011.

A. Sanchez-Stern, P. Panchekha, S. Lerner, and Z. Tatlock, “Finding root causes of floating point error,” ACM SIGPLAN Not., vol. 53, no. 4, pp. 256–269, 2018.

K. Ismail and N. A. Rachman, “Dekoder Empat Bit Binary Code Decimal ( Bcd ) Untuk Dua Digit Seven Segment,” Semin. Nas. Telekomun. dan Inform., vol. Bandung, 2, no. Selisik, pp. 325–330, 2018.

F. I. Mugivane, Introduction To Computer. 2014.

M. Sari and A. Prasetyo, “Program Konversi Sistem Bilangan Desimal ke Biner dan Oktal Menggunakan Pemrograman C++ Berbasis Codeblock,” Dec. 2018.

“Pengertian & Perbedaan antara bit (b) dengan Byte (B) – JalaWave Connection,” Nov-2016. [Online]. Available: [Accessed: 10-Jun-2020].

E. Isbn, “Table of Contents Getting Help in an Integrated Development Environment,” no. August 1997, 2003.

R. E. Bryant and D. R. O. Hallaron, Computer Systems. A Programmer’s Perspective [3rd ed.]. Boston: Pearson, 2016.

C. Sinthanayothin and W. Bholsithi, “Dental application: The steps toward the implementation of the cephsmile plus services,” Int. J. Adv. Comput. Technol., vol. 3, no. 3, pp. 210–221, 2011.

Peter Gottschling, Discovering Modern C++. An Intensive Course for Scientists, Engineers,and Programmers. Pearson Education, 2016.

U. Sidi, M. Ben Abdellah, M. Fez, D. Chenouni, M. Berrada, and A. Tahiri, “Paper—A Serious Game for Learning C Programming Language Concepts Using Solo Taxonomy A Serious Game for Learning C Programming Language Concepts Using Solo Taxonomy Alaeeddine Yassine,” iJET, pp. 110–127, 2017.

P. Lindstrom, S. Lloyd, and J. Hittinger, “Universal coding of the reals: Alternatives to IEEE floating point,” ACM Int. Conf. Proceeding Ser., no. March, 2018.

K. Yordzhev, “The Bitwise Operations Related to a Fast Sorting Algorithm,” Int. J. Adv. Comput. Sci. Appl., vol. 4, no. 9, 2013.

I. Corporation, “[3]Intel ® 64 and IA-32 Architectures Software Developer ’ s Manual Documentation Changes,” System, vol. 3, no. 253665, 2011.

R. Chandra, S. Rawat, and T. Jain, “Application of Bitwise Operators in C,” Int. J. Sci. Eng. Res., vol. 4, no. 11, pp. 1–4, 2013.

A. Burud and P. Bhaskar, “Design and Implementation of FPGA Based 32 Bit Floating Point Processor for DSP Application,” Proc. - 2018 4th Int. Conf. Comput. Commun. Control Autom. ICCUBEA 2018, no. ref 15, pp. 1–5, 2018.

“C Programming Conditional Operator (?:) - Trytoprogram.” [Online]. Available: . [Accessed: 10-Jun-2020].

U. Suharsaputra, Metode Penelitian Kuantitatif, Kualitatif, dan Tindakan. Bandung: Alfabeta, 2012.

Creative Commons License
IJID (International Journal on Informatics for Development) is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License