Hello all.

I am new to programming and taking my first programming course which is basic C++ programming. However I am stuck on a exercise and not sure what to do.

The exercise is:Write a program that asks the user to input a 4 digit binary number and print its decimal equivalent.

Like I said this is a basic course and only a month in, so still new to things right now.

Right now I have

I am not sure what to do to make it so it would convert it to decimal. I know how to convert binary to decimal (To convert 1101 it is 1 * 1 + 0 * 2 + 1 * 4 + 1 * 8, or 1 + 0 + 4 + 8 or 13).Code:#include<iostream> using namespace std; int main() { int binary, decimal; cout << "Enter a 4-digit binary number: " ; cin >> binary; decimal = cout << "The decimal equivalent of " << binary << " is " << decimal << endl; system("pause"); return 0; }

If someone could give me some help on what my calculation would be to convert it, that would be great.