Ver Mensaje Individual
  #6  
Antiguo 04-06-2015
anonymous anonymous is offline
Miembro
NULL
 
Registrado: may 2015
Posts: 23
Reputación: 0
anonymous Va por buen camino
Ayuda con este Problema

BUENAS TENGO UN PROBLEMITA ME QUEDE ATASCADO EN DONDE DICE : Imagen ( Como lo ven los demas ) Imagen1.jpg
No se como descomponer los numeros para hacer la suma no se si me entienden ... DALEE.jpg
CADA LETRA VALE UN NUMERO .. PERO A LA HORA DE DESMENUZAR LAS LETRAS NO SE HACER LA SUMA
este es mi codigo :
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
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

{$R *.dfm}




procedure TForm3.BitBtn1Click(Sender: TObject);
Var i, cant ,cant1,cont,cont1,suma,suma1,resultado,sumav,sumac,p,sumatotal,dig: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;


   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','Ñ','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;
     end;

   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;

 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;


   Memo1.Lines.add('-------------------------------- ');
   Memo1.Lines.Add('ESENCIA (lo que usted Quiere)');
   Memo1.Lines.Add(linea);
   Memo1.Lines.Add(inttostr(sumav));

    linea := '';
   cont1:= 0;
   for i := 1 to length (nom) do
   if nom [i] in ['B','C','D','F','G','H','J','K','L','M','Ñ','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;
 if nom [i] in ['J','S'] then
       sumac:=sumac+1;
        if nom [i] in ['B','K','T'] then
          sumac:=sumac+2;
            if nom [i] in ['C','L'] then
              sumac:=sumac+3;
                if nom [i] in ['D','M','V'] then
                  sumac:=sumac+4;
                    if nom [i] in ['N','W'] then
                      sumac:=sumac+5;
                       if nom [i] in ['F','X'] then
                         sumac:=sumac+6;
                          if nom [i] in ['G','P','Y'] then
                            sumac:=sumac+7;
                             if nom [i] in ['H','Q','Z'] then
                               sumac:=sumac+8;
                               if nom [i] in ['R'] then
                                 sumac:=sumac+9;
               end;



   Memo1.Lines.add('-------------------------------- ');
   Memo1.Lines.Add('IMAGEN (como lo ven los demas)');
   Memo1.Lines.Add(linea1);
   Memo1.Lines.Add(inttostr(sumac));


end;


end.
Responder Con Cita