Hi i made a program for conversion decimal to binary number ... but i need to convert the big dottef number into dotted binary like this
For example 10.10.0.13 is <00001010.00001010.00000000.00001101>
8-bit of every integer ..
This is making me confuse how to make it ? my conversion code is below can anyone help me for modified to above program of this code .
#include <iostream>
using namespace std;
int main() {
int n; // number to convert to binary
while (cin >> n) {
if (n > 0) {
cout << n << " (decimal) = ";
while (n > 0) {
cout << n%2;
n = n/2;
}
cout << " (binary) in reverse order" << endl;
} else {
cout << "Please enter a number greater than zero." << endl;
}
}
return 0;
}