이 작업을 해결하려고합니다. http://www.codeabbey.com/index/task_view/parity-control 출력으로 웹 사이트 및 비주얼 스튜디오 콘솔의 빈 공간에 많은 물음표가 표시됩니다. 인쇄하려고하면 160, char (\ 'u0160')로 모든 작동합니다, 괜찮아요,하지만 int 숯불 캐스팅 경우 공백 얻을. 인터넷을 검색하여 16 진수의 변환을 char로 시도했지만 int를 char로 변환하는 것과 같은 방식으로 작업하고 공백을 다시 얻습니다.정수 또는 16 진수 값을 유니 코드 포인트로 변환하십시오.
왜 이러한 물음표가 표시됩니까? 인코딩 등을 변경해야합니까? 16 진수 또는 int에서 유니 코드 포인트를 만든 다음 다음을 수행 할 수 있습니다. char output = convertedValue; Here`s 위의 작업에 대한 내 코드 :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;
using System.Text.RegularExpressions;
class Program
{
static void Main(string[] args)
{
string buffer = Console.ReadLine();
string[] container = buffer.Split(' ');
byte[] asciiCodes = new byte[container.Length];
for (int i = 0; i < container.Length; i++)
{
asciiCodes[i] = byte.Parse(container[i]);
}
for (int i = 0; i < asciiCodes.Length; i++)
{
byte currNumber = asciiCodes[i];
string binaryRepresent = Convert.ToString(currNumber, 2).PadLeft(8, '0');
int counter = 0;
for (int j = 0; j < binaryRepresent.Length; j++)
{
if(binaryRepresent[j] == '1')
{
counter++;
}
}
if(counter % 2 == 0)
{
char output = Convert.ToChar(currNumber);
Console.Write(output);
}
}
}
}
감사 남자, 작동 :) – Vallerious