Code:Complete the program below which converts a binary number into a decimal number. Sample outputs are shown belowComplete the program below which converts a binary number into a decimal number. Sample outputs are shown below. Sample Output 1:Sample Output 2:

8-bit Binary Number => 11111111Decimal Number = 255Sample Output 3:

8-bit Binary Number => 10101010Decimal Number = 170

8-bit Binary Number => 101010102Number entered is not a binary numberAnyone knows the solution? I m really thank you.#include <iostream> using namespace std; int main() { int num; cout << "8-bit Binary Number="; cin >> num; bool valid = true;. if (valid) { cout << "Decimal Number = " << sum; } }

. . . . . . . . . . . . .