Skip to main content

Posts

Showing posts from May, 2017

Introduction To C++ Programming - Part 10.

C++ Program To Convert Binary Number To Decimal & Vice-Versa. #include <iostream> #include <cmath> using namespace std; int binary_decimal(int n); int decimal_binary(int n); int main() { int n; char c; cout << "Instructions: " << endl <<endl; cout << "1. Enter Alphabet 'd' To Convert Binary To Decimal." << endl; cout << "2. Enter Alphabet 'b' To Convert Decimal to Binary." << endl << endl; cin >> c; if (c =='d' || c == 'D') { cout << "\nEnter A Binary Number: "; cin >> n; cout << endl << n << " In Binary = " << binary_decimal(n) << " In Decimal" << endl; } if (c =='b' || c == 'B') { cout << "\nEnter A Decimal number: "; cin >> n; cout << endl << n << " In Decimal =