Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 05-03-2007
fidel fidel is offline
Miembro
 
Registrado: mar 2005
Posts: 381
Poder: 20
fidel Va por buen camino
Hola:

Si es para practicar o por otra razón puedes hacerte la calculadora, pero si no llama desde Delphi a la de windows y ya está.
Código Delphi [-]
ShellExecute(Handle, 'open', 'calc.exe', nil, nil, SW_SHOW);

Un saludo.
Responder Con Cita
  #2  
Antiguo 06-03-2007
keikurono keikurono is offline
Miembro
 
Registrado: mar 2007
Posts: 16
Poder: 0
keikurono Va por buen camino
aver que les parece este codigo....
Solucion al problema de la calcu en delphi!!!!!
Código Delphi [-]
 
unit calcu_Until;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
arreg1=array[1..100,1..100] of string;
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
w:boolean;
B:arreg1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
    begin
        w:=true;
    end;
procedure TForm1.Button2Click(Sender: TObject);//boton suma
    begin
       if edit1.Text<>'' then
            if W=true then
                begin
                   B[1,1]:=edit1.Text;
                   B[1,2]:='+';
                   W:=false;
                   edit1.Text:='';
                   edit1.SetFocus;
                end
           else
               begin
                     B[2,1]:=edit1.Text;
                          if B[1,2]='+' then
                                B[1,1]:=floattostr(strtofloat(B[1,1])+strtofloat(B[2,1]));
                          if B[1,2]='/' then
                                if B[2,1]<>'0' then
                                       B[1,1]:=floattostr(strtofloat(B[1,1])/strtofloat(B[2,1]))
                                else
                                       MESSAGEDLG('EL DIVIDENDO DEVE DE SER <>0',mTInformation,[mbok],0);
                          if B[1,2]='-' then
                                B[1,1]:=floattostr(strtofloat(B[1,1])-strtofloat(B[2,1]));
                          if B[1,2]='*' then
                                B[1,1]:=floattostr(strtofloat(B[1,1])*strtofloat(B[2,1]));
                    B[1,2]:='+';
                    edit1.Text:=B[1,1];
                    edit1.SetFocus;
                    W:=false;
                    B[2,1]:='';
             end;
 
end;
procedure TForm1.Button3Click(Sender: TObject);//BOTON RESTA
begin
       if edit1.Text<>'' then
              if W=true then
                  begin
                      B[1,1]:=edit1.Text;
                      B[1,2]:='-';
                      W:=false;
                      edit1.Text:='';
                      edit1.SetFocus;
                 end
             else
                  begin
                       B[2,1]:=edit1.Text;
                            if B[1,2]='+' then
                                  B[1,1]:=floattostr(strtofloat(B[1,1])+strtofloat(B[2,1]));
                            if B[1,2]='-' then
                                  B[1,1]:=floattostr(strtofloat(B[1,1])-strtofloat(B[2,1]));
                            if B[1,2]='*' then
                                  B[1,1]:=floattostr(strtofloat(B[1,1])*strtofloat(B[2,1]));
                            if B[1,2]='/' then
                                  if B[2,1]<>'0' then
                                      B[1,1]:=floattostr(strtofloat(B[1,1])/strtofloat(B[2,1]))
                                  else
                                      MESSAGEDLG('EL DIVIDENDO DEVE DE SER DISTINTO DE CERO',mTInformation,[mbok],0);                            
                            B[1,2]:='-';
                            edit1.Text:=B[1,1];
                            edit1.SetFocus;
                            W:=false;
                            B[2,1]:='';
                    end;
end;
procedure TForm1.Button4Click(Sender: TObject);//BOTON POR
     begin
         if edit1.Text<>'' then
              if W=true then 
                 begin
                     B[1,1]:=edit1.Text;
                     B[1,2]:='*';
                     W:=false;
                     edit1.Text:='';
                     edit1.SetFocus;
                 end
             else
                 begin
                      B[2,1]:=edit1.Text;
                            if B[1,2]='+' then
                                  B[1,1]:=floattostr(strtofloat(B[1,1])+strtofloat(B[2,1]));
                            if B[1,2]='-' then
                                  B[1,1]:=floattostr(strtofloat(B[1,1])-strtofloat(B[2,1]));
                            if B[1,2]='*' then
                                  B[1,1]:=floattostr(strtofloat(B[1,1])*strtofloat(B[2,1]));
                            if B[1,2]='/' then
                                   if B[2,1]<>'0' then
                                           B[1,1]:=floattostr(strtofloat(B[1,1])/strtofloat(B[2,1]))
                                   else
                                           MESSAGEDLG('EL DIVIDENDO DEVE DE SER DISTINTO DE CERO',mTInformation,[mbok],0);

                            B[1,2]:='*';
                            edit1.Text:=B[1,1];
                            edit1.SetFocus;
                            W:=false;
                            B[2,1]:='';
                   end;
end;
procedure TForm1.Button5Click(Sender: TObject);//boton entre
  begin
       if edit1.Text<>'' then
             if W=true then
                 begin
                      B[1,1]:=edit1.Text;
                      B[1,2]:='/';
                      W:=false;
                      edit1.Text:='';
                      edit1.SetFocus;
                 end
             else
                 begin
                      B[2,1]:=edit1.Text;
                           if B[1,2]='+' then
                                  B[1,1]:=floattostr(strtofloat(B[1,1])+strtofloat(B[2,1]));
                           if B[1,2]='-' then
                                  B[1,1]:=floattostr(strtofloat(B[1,1])-strtofloat(B[2,1]));
                           if B[1,2]='*' then
                                  B[1,1]:=floattostr(strtofloat(B[1,1])*strtofloat(B[2,1]));
                           if B[1,2]='/' then
                                 if B[2,1]<>'0' then
                                       B[1,1]:=floattostr(strtofloat(B[1,1])/strtofloat(B[2,1]))
                           else
                                 MESSAGEDLG('EL DIVIDENDO DEVE DE SER DISTINTO DE CERO',mTInformation,[mbok],0);
                           
                       B[1,2]:='/';
                       edit1.Text:=B[1,1];
                       edit1.SetFocus;
                       W:=false;
                       B[2,1]:='';
               end;
 
end;
procedure TForm1.Button1Click(Sender: TObject);//boton igual 
   begin
        if (B[2,1]='')and(B[1,2]<>'')then
             B[2,1]:=edit1.Text;
        if B[1,2]='+' then
             B[1,1]:=floattostr(strtofloat(B[1,1])+strtofloat(B[2,1]));
        if B[1,2]='-' then
             B[1,1]:=floattostr(strtofloat(B[1,1])-strtofloat(B[2,1]));
        if B[1,2]='*' then
             B[1,1]:=floattostr(strtofloat(B[1,1])*strtofloat(B[2,1]));
        if B[1,2]='/' then
             if B[2,1]<>'0' then
                  B[1,1]:=floattostr(strtofloat(B[1,1])/strtofloat(B[2,1]))
             else
                  MESSAGEDLG('EL DIVIDENDO DEVE DE SER DISTINTO DE CERO',mTInformation,[mbok],0);
        B[2,1]:='';
        B[1,2]:='';
        edit1.Text:=B[1,1];
        w:=TRUE;
 
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
  begin
       if not (key in ['0'..'9',#8]) then
          begin
              key:=#0;
              beep;
          end;
  end;
end.

Última edición por keikurono fecha: 10-03-2007 a las 05:36:13.
Responder Con Cita
  #3  
Antiguo 10-03-2007
keikurono keikurono is offline
Miembro
 
Registrado: mar 2007
Posts: 16
Poder: 0
keikurono Va por buen camino
La nota es que es muy larga porque siempre repito este codigo en los 4 botones (+, -, *, /)
Código SQL [-]
 if B[1,2]='+' then
             B[1,1]:=floattostr(strtofloat(B[1,1])+strtofloat(B[2,1]));
        if B[1,2]='-' then
             B[1,1]:=floattostr(strtofloat(B[1,1])-strtofloat(B[2,1]));
        if B[1,2]='*' then
             B[1,1]:=floattostr(strtofloat(B[1,1])*strtofloat(B[2,1]));
        if B[1,2]='/' then
             if B[2,1]<>'0' then
                  B[1,1]:=floattostr(strtofloat(B[1,1])/strtofloat(B[2,1]))
             else
                  MESSAGEDLG('EL DIVIDENDO DEVE DE SER DISTINTO DE CERO',mTInformation,[mbok],0);

Alguien save eso de como utilizar en un project como estos, eso de prosedimiento ???, por que con eso se acortaria mejor .
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
calculadora de conjuntos...insercion, union,etc sakuragi JAVA 3 19-02-2009 16:46:59
Calculadora Epunamun OOP 3 19-12-2005 22:33:11
Calculadora licencia GNU bismarck_sierra Varios 0 05-04-2005 06:56:33
Componente Calculadora Gustavo Gowdak OOP 4 23-01-2005 13:19:14
Ejecutar la calculadora en una posición de la pantalla cybergerman OOP 11 27-09-2004 09:13:33


La franja horaria es GMT +2. Ahora son las 17:57:11.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi