sacar consonantes de una palabra
Publicado por Enrique (2 intervenciones) el 13/10/2019 07:53:15
Hola buenas tardes estoy haciendo un tipo contaseña pero me piden que del nombre saque las consonantes del nombre y cuando tienes las consonantes solamente use la 2 y 3 consonante que tiene el nombre
en el archivos les dejo el archivo con en programa que estoy haciendo espero me puedan ayudar
gracias.
PD:no me permitio subir el archivo se los dejo aqui perdon
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
en el archivos les dejo el archivo con en programa que estoy haciendo espero me puedan ayudar
gracias.
PD:no me permitio subir el archivo se los dejo aqui perdon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace practica4
{
class rfc
{
public string nombre;
public string AP;
public string AM;
public string fecha;
public string lugar;
public string contraseña;
public rfc(string nombre, string AP, string AM, string fecha, string lugar,string contraseña)
{
this.nombre = nombre;
this.AP = AP;
this.AM = AM;
this.fecha = fecha;
this.lugar = lugar;
this.contraseña = contraseña;
}
public override string ToString()
{
return nombre+" "+AP+" "+AM+" nacio el dia "+fecha+" en "+lugar+ " la contraseña generada es "+contraseña+"\n";
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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 practica4
{
public partial class Form1 : Form
{
List<rfc> rfcs = new List<rfc>();
string contraseña= "";
string salida = "";
public Form1()
{
InitializeComponent();
}
private void label3_Click(object sender, EventArgs e)
{
}
private void buttonregistrar_Click(object sender, EventArgs e)
{
string nombre = textBoxnombre.Text;
string AP = textBoxAP.Text;
string AM = textBoxAM.Text;
string fecha = textBoxFechaN.Text;
string lugar = textBoxLugardeNa.Text;
rfc rf = new rfc(nombre, AP, AM, fecha, lugar, contraseña);
rfcs.Add(rf);
if (nombre.Length == 0 && AP.Length == 0 && AM.Length == 0 && fecha.Length == 0 && lugar.Length == 0)
{
MessageBox.Show("Ningun campo puede estar vacio....!!!!");
}
string AP2 = AP.Substring(0, 2);
string AM2 = AM.Substring(AM.Length - 1, 1);
string fecha2 = fecha.Substring(8, 2);
string salida = AM2;
string dosLetras = "";
Random rnd = new Random();
for (int i = 0; i < 2; i++)
{
int Uno = rnd.Next(0, lugar.Length);
dosLetras += lugar[Uno];
}
contraseña = AP2 + AM2 + fecha2 + dosLetras;
textBoxAM.Clear();
textBoxAP.Clear();
textBoxnombre.Clear();
textBoxFechaN.Clear();
textBoxLugardeNa.Clear();
}
private void button1_Click(object sender, EventArgs e)
{
foreach (var a in rfcs)
{
salida += a.ToString();
}
MessageBox.Show(salida);
}
}
}
Valora esta pregunta


0