Proyecto a Corregirb

download Proyecto a Corregirb

If you can't read please download the document

description

b bnbn

Transcript of Proyecto a Corregirb

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace ProyectoOndasDigitales{ class Program { static bool esValido(string numero, string _base) { bool Digita = false; for (int i = 0; i < numero.Length; i++) if (Convert.ToInt32(numero[i].ToString()) < Convert.ToInt32(_base)) Digita = true; else return false; return Digita; } static bool esletra(string letra) { if (letra == "a" || letra == "A") return true; if (letra == "b" || letra == "B") return true; if (letra == "c" || letra == "C") return true; if (letra == "d" || letra == "D") return true; if (letra == "e" || letra == "E") return true; if (letra == "f" || letra == "F") return true; if (letra == "g" || letra == "G") return true; if (letra == "h" || letra == "H") return true; return false; } static int extraerValor(string letra) { if (letra == "a" || letra == "A") return 10; if (letra == "b" || letra == "B") return 11; if (letra == "c" || letra == "C") return 12; if (letra == "d" || letra == "D") return 13; if (letra == "e" || letra == "E") return 14; if (letra == "f" || letra == "F") return 15; if (letra == "g" || letra == "G") return 16; if (letra == "h" || letra == "H") return 16; return Convert.ToInt32(letra.ToString()); } static string ExtraerLetra(int valor) { if (valor == 10) return "A"; if (valor == 11) return "B"; if (valor == 12) return "C"; if (valor == 13) return "D"; if (valor == 14) return "E"; if (valor == 15) return "F"; if (valor == 16) return "G"; if (valor == 17) return "H"; return valor.ToString(); } static bool esHExadecimal(int valor) { if (valor >= 10 && valor