ESTE ES MI CODIGO POR LAS DUDAS NO SE SI ESTA ALGO BIEN O MAL
Código Delphi
[-]
unit JEBUS;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm3 = class(TForm)
BitBtn1: TBitBtn;
Edit1: TEdit;
Memo1: TMemo;
Label1: TLabel;
EdNom: TEdit;
Label2: TLabel;
procedure BitBtn1Click(Sender: TObject);
private
public
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm3.BitBtn1Click(Sender: TObject);
Var i, cant ,cant1,cont,cont1,suma,suma1,resultado,sumav,sumac: Integer;
nom, linea,linea1,linea2,linea3,linea4: string;
begin
Memo1.Visible:=true;
nom := EdNom.Text;
linea := '';
cant := 0;
for i:=1 to length(nom) do
if nom[i] in ['A','E','I','O','U','a','e','i','o','u'] then begin
linea := linea + nom[i] +' ';
cant := cant + 1;
end;
case nom [i] of
'A':cont:=1;
'E':cont:=5;
'I':cont:=9;
'O':cont:=6;
'U':cont:=3;
end;
Memo1.clear;
Memo1.Lines.add('Su nombre contiene las vocales');
Memo1.Lines.Add(linea);
Memo1.Lines.Add('Total de vocales= '+ IntToStr(Cant));
linea := '';
cont1:= 0;
for i := 1 to length (nom) do
if nom [i] in ['B','C','D','F','G','H','J','K','L','M','Ñ','O','P','Q','R','S','T','V','W','X','Y','Z','b','c','d', 'f','g','h','j','k','l','m','n','ñ','p','q','r','s','t','v','w','x','y','z'] then
begin
linea1 := linea1 + nom[i] +' ';
cant1 := cant1 + 1;
case nom [i] of
'J','S':cont1:= 1;
'B','K','T':cont1:= 2;
'C','L':cont1:=3;
'D','M','V':cont1:= 4;
'N','W':cont1:=5;
'F','X':cont1:=6;
'G','P','Y':cont1:=7;
'H','Q','Z':cont1:=8;
'R':cont1:=9;
end;
end;
linea4:=linea4+inttostr(cont)+' ';
linea3:=linea3+nom[i]+' ';
cant1:=cant1+1;
Memo1.Lines.add('-------------------------------- ');
Memo1.Lines.add('Cantidad de Consonantes');
Memo1.Lines.Add(linea1);
Memo1.Lines.Add('Total de Consonantes= '+ IntToStr(Cant1));
linea := '';
cant := 0;
for i:=1 to length(nom) do
begin
if nom[i] in ['A','E','I','O','U','a','e','i','o','u'] then
begin
linea := linea + nom[i] +' ';
cant := cant + 1;
begin
if nom [i] in ['A'] then
sumav:=sumav+1;
if nom [i] in ['E'] then
sumav:=sumav+5;
if nom [i] in ['I'] then
sumav:=sumav+9;
if nom [i] in ['O'] then
sumav:=sumav+6;
if nom [i] in ['U'] then
sumav:=sumav+3;
end;
end;
end;
Memo1.Lines.add('-------------------------------- ');
Memo1.Lines.Add('ESENCIA (lo que usted Quiere)');
Memo1.Lines.Add(linea);
Memo1.Lines.Add(inttostr(sumav));
Memo1.Lines.add('-------------------------------- ');
Memo1.Lines.Add('IMAGEN (como lo ven los demas)');
Memo1.Lines.Add(linea);
Memo1.Lines.Add(inttostr(cont1));
end;
end.