C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[57867] 계산기를 만들려고하는데 않되요 ㅠㅠ 도와주세요
비익조 [kkalnal1] 912 읽음    2009-07-31 14:13
오류.jpg 52.3KB 처음 뜨는 오류입니다
오류_00000.jpg 126.7KB 그다음 프로젝트.cpp 에 뜨는것입니다
제가 완전 초보인데

계산기를 만들어 볼려고 하는데 이상한 오류가 뜨네요

직접 짠거는 아니고 다른사람들이 작성한 소스 를 응용해서 해봤는데

않되요 고수님들 도와주세요

어떤 오류인지는 그림파일로 올리겠습니다

아래는 제가 응용한 소스입니다

#include <vcl.h>
#pragma hdrstop

#include "computer.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
double Pre_num; //처음입력한 수를 기억
bool Dot_Check;
int InNew;     // 처음입력한수를 체크


//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
        Pre_num = 0 ;
        Dot_Check = false ;
        InNew = true ;
        operater = "" ;
        Edit1->Font->Style = Edit1->Font->Style << fsBold ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
        if(operater.Length()<1)
                sNum1+="1" ;
        else
                sNum2+="1" ;
        if (InNew)
        {
                Edit1->Text = "" ;
                InNew = false ;
        }
        if (Edit1->Text == "0")
                Edit1->Text = "1" ;

        else
                Edit1->Text=Edit1->Text + "1" ;
}



//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)
{
        if(operater.Length()<2)
                sNum1+="2" ;
        else
                sNum2+="2" ;
        if (InNew)
        {
                Edit1->Text = "" ;
                InNew = false;
        }
        if (Edit1->Text == "0")
                Edit1->Text = "2" ;

        else
                Edit1->Text=Edit1->Text + "2" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button3Click(TObject *Sender)
{
        if(operater.Length()<3)
                sNum1+="3" ;
        else
                sNum2+="3" ;
        if (InNew)
        {
                Edit1->Text = "" ;
                InNew = false;
        }
        if (Edit1->Text == "0")
                Edit1->Text = "3" ;

        else
                Edit1->Text=Edit1->Text + "3" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button4Click(TObject *Sender)
{
        if(operater.Length()<4)
                sNum1+="4" ;
        else
                sNum2+="4" ;
        if (InNew)
        {
                Edit1->Text = "" ;
                InNew = false;
        }
        if (Edit1->Text == "0")
                Edit1->Text = "4" ;

        else
                Edit1->Text=Edit1->Text + "4" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button5Click(TObject *Sender)
{
        if(operater.Length()<5)
                sNum1+="5" ;
        else
                sNum2+="5" ;
        if (InNew)
        {
                Edit1->Text = "" ;
                InNew = false;
        }
        if (Edit1->Text == "0")
                Edit1->Text = "5" ;

        else
                Edit1->Text=Edit1->Text + "5" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button6Click(TObject *Sender)
{
        if(operater.Length()<6)
                sNum1+="6" ;
        else
                sNum2+="6" ;
        if (InNew)
        {
                Edit1->Text = "" ;
                InNew = false;
        }
        if (Edit1->Text == "0")
                Edit1->Text = "6" ;

        else
                Edit1->Text=Edit1->Text + "6" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button7Click(TObject *Sender)
{
        if(operater.Length()<7)
                sNum1+="7" ;
        else
                sNum2+="7" ;
        if (InNew)
        {
                Edit1->Text = "" ;
                InNew = false;
        }
        if (Edit1->Text == "0")
                Edit1->Text = "7" ;

        else
                Edit1->Text=Edit1->Text + "7" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button8Click(TObject *Sender)
{
        if(operater.Length()<8)
                sNum1+="8" ;
        else
                sNum2+="8" ;
        if (InNew)
        {
                Edit1->Text = "" ;
                InNew = false;
        }
        if (Edit1->Text == "0")
                Edit1->Text = "8" ;

        else
                Edit1->Text=Edit1->Text + "8" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button9Click(TObject *Sender)
{
        if(operater.Length()<9)
                sNum1+="9" ;
        else
                sNum2+="9" ;
        if (InNew)
        {
                Edit1->Text = "" ;
                InNew = false;
        }
        if (Edit1->Text == "0")
                Edit1->Text = "9" ;

        else
                Edit1->Text=Edit1->Text + "9" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button10Click(TObject *Sender)
{
        if(operater.Length()<0)
                sNum1+="0" ;
        else
                sNum2+="0" ;
        if (InNew)
        {
                Edit1->Text = "" ;
                InNew = false;
        }
        if (Edit1->Text == "0")
                return ;

        else
                Edit1->Text=Edit1->Text + "0" ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button16Click(TObject *Sender)
{
        if (InNew)
        {
                Edit1->Text = "" ;
                InNew = false ;
        }

        if (Dot_Check) return ;
       
        Edit1->Text = Edit1->Text + "." ;
       
        Dot_Check = true ;
       
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button12Click(TObject *Sender)//더하기
{
        Pre_num = StrToInt(Edit1->Text) ;
       
        InNew = true ;
        Dot_Check = false ;
        operater = Button12->Caption ;
        Edit1 -> Text = Edit1 -> Text + "+" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button13Click(TObject *Sender)//빼기
{

        Pre_num = StrToInt(Edit1->Text) ;
       
        InNew = true ;
        Dot_Check = false ;
        operater = Button13->Caption ;
        Edit1 -> Text = Edit1 -> Text + "-" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button14Click(TObject *Sender)//곱하기
{

        Pre_num = StrToInt(Edit1->Text) ;
       
        InNew = true ;
        Dot_Check = false ;
        operater = Button14->Caption ;
        Edit1 -> Text = Edit1 -> Text + "*" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button15Click(TObject *Sender)//나누기
{
        Pre_num = StrToInt( Edit1->Text ) ;
       
        InNew = true ;
        Dot_Check = false ;
        operater = Button15->Caption ;
        Edit1 -> Text = Edit1 -> Text + "/" ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ButtonClearClick(TObject *Sender)
{
        sNum1=sNum2=operater="" ;
        Edit1->Clear() ;
        Dot_Check = false ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button11Click(TObject *Sender)
{
       
        float   fNum1 = StrToFloat( sNum1 ) ;

        float   fNum2 = StrToFloat( sNum2 ) ;

        float   fResult ;

       
        if ( operater == '+' )
                fResult = fNum1 + fNum2 ;
               
        else if ( operater == '-' )
                fResult = fNum1 - fNum2 ;
               
               
        else if ( operater == '/' )
                fResult = fNum1 / fNum2 ;
               
               
        else if ( operater == '*' )
                fResult = fNum1 * fNum2 ;
               
        Edit1->Text = sNum1+ operater + sNum2 + "="+FloatToStr(fResult) ;

+ -

관련 글 리스트
57867 계산기를 만들려고하는데 않되요 ㅠㅠ 도와주세요 비익조 912 2009/07/31
57868     Re:계산기를 만들려고하는데 않되요 ㅠㅠ 도와주세요 장성호 1019 2009/07/31
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.