using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace numero9
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Variables
string frase, caracter;
int c = 0, i;
//Entrada
private void textBox1_TextChanged(object sender, EventArgs e)
{
frase = entrada.Text;
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
caracter = letra.Text;
}
//Proceso y salida
private void button1_Click(object sender, EventArgs e)
{
for (i = 0; i <= frase.Length - 1; i++)
{
if (frase.ToUpper().Substring(i, 1).Equals(caracter.ToUpper()))
c++;
}
textBox2.Text = c.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
No hay comentarios:
Publicar un comentario
Nota: solo los miembros de este blog pueden publicar comentarios.