Saturday, October 12, 2019

Decimal To Binary Number Converter in C++

 I will discuss how to create a program using C++ to ask the user to give a decimal number and then the program will convert the decimal number into binary number equivalent.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.


Sample Program Output


Program Listing

// binary.cpp
// Author : Jake Rodriguez Pomperada,MAED-IT
// Date   : October 12, 2019  Saturday  2:31 PM
// Email  : jakerpomperada@gmail.com

#include <iostream>
#include <iomanip>

using namespace std;

int main(){
long int decnum=0,rem=0,quot=0;
int binnum[100], i=1, j=0;
cout <<"\n\n";
cout <<"\tDecimal To Binary Converter in C++";
cout <<"\n\n";
cout << "\tGive Any Decimal Number : ";
cin >> decnum;
quot=decnum;
while (quot != 0) {
binnum[i++] = quot % 2;
quot = quot/2;
}
cout <<"\n\n";
cout <<"\tEquivalent binary Value of "
     << decnum << " : \n";
     cout <<"\n";
     cout <<"\t";
    for (j=i-1; j>0; j--) {
cout << binnum[j];
}      
cout <<"\n\n";
cout <<"\tEnd of the Program";

}






 

No comments:

Post a Comment