各位大哥,帮小弟一个忙呀。555555555555
这个小程序能够编译成功,但是操作的时候除了点问题:
头文件:
//---------------------------------------------------------------------------
#ifndef jsH
#define jsH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <math.h>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TEdit *Edit1;
TEdit *Edit2;
TEdit *Edit3;
TEdit *Edit4;
TButton *Button1;
TButton *Button2;
void __fastcall Button1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
原代码:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "js.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
float a,b,c,p,s;
a=StrToFloat(Edit1->Text);
b=StrToFloat(Edit2->Text);
c=StrToFloat(Edit3->Text);
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
Edit4->Text=FloatToStr(s);
}
//---------------------------------------------------------------------------
异常文件:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
USERES("Bjs.res");
USEFORM("js.cpp", Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}//箭头就是指着这里的。
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
//---------------------------------------------------------------------------
问题提示:
project bjs.exe raised exception class Econvert Error with message "is not a valid floatint point value ".process stopped .use step
or run to continue.
view cpu window