好的,在尝试了在其他问题和谷歌上找到的大量解决方案后,我似乎找不到解决这个问题的方法。这是我的代码,感谢您的帮助,它让我发疯,谢谢!
int iBinaryNum; //To store binary number
string sDecimalNum; //To store decimal numbers
Console.WriteLine("Enter the binary number you want to convert to decimal");
iBinaryNum = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("The Binary number you have entered is " + iBinaryNum);
sDecimalNum = Convert.ToString(iBinaryNum, 2);
Console.WriteLine("This converted into decimal is " + sDecimalNum);
//Prevent program from closing
Console.WriteLine("Press any key to close");
Console.ReadKey();