public static void MajorityVoting() { Console.Write("Enter the character to be encoded --> "); char character = Convert.ToChar(Console.ReadLine()); int ASCIICode = Convert.ToInt32(character); Console.WriteLine("The ASCII Code is: {0}", ASCIICode); string binary = Other.DecimalToBinary(ASCIICode); Console.WriteLine("The binary of this is: {0}", binary); Console.Write("Enter the number of times you would like to repeat the digits --> "); int repeat = int.Parse(Console.ReadLine()); string binExtend = ""; for (int bitNo = 0; bitNo < binary.Length; bitN) { } }
public static void Parity() { Console.Write("Enter the character to be encoded --> "); char character = Char.Parse(Console.ReadLine()); int ASCIICode = Convert.ToInt32(character); Console.WriteLine("The ASCII Code is: {0}", ASCIICode); string binary = Other.DecimalToBinary(ASCIICode); Console.WriteLine("The binary of this is: {0}", binary); Console.Write("Would you like to use o/e parity? -->"); string qParity = Console.ReadLine(); int parityBit; if (qParity == "e") { Console.WriteLine("Even Parity being used"); parityBit = ParityBit(int.Parse(binary), 'e'); } else { Console.WriteLine("Odd Parity being used"); parityBit = ParityBit(int.Parse(binary), 'o'); } Console.WriteLine("The parity bit is: {0}", parityBit); string output = parityBit.ToString() + binary; Console.WriteLine("The full code is: {0}", output); }