我正在尝试创建一个程序,询问您的姓名,然后根据ASCII表显示您姓名的每个字符的数量。现在我希望每个数字都转换成二进制数字......我被卡住了! :) 请帮忙! 这是我的代码:
using System;
namespace DecimalToBinary
{
class DecimalToBinary
{
static void Main()
{
Console.WriteLine("Pleasse, enter your name:");
string name = Console.ReadLine();
foreach (char ch in name)
{
Console.WriteLine("Character {0} is {1} according to ASCII table.", ch, (int)ch);
}
foreach (char ch in name)
{
int decNumber = ch;
Console.WriteLine(decNumber);
}
Console.WriteLine("Enter a number:");
int number = Int32.Parse(Console.ReadLine());
string binary = Convert.ToString(number, 2);
Console.WriteLine(binary);
}
}
}
答案 0 :(得分:2)
您的意思是将每个ASCII值转换为二进制以及简单整数吗?
http://localhost:3099/api/v1/articles?page=1