[C++ Error] Caculater.cpp(21): E2141 Declaration syntax error

pythonpowered pythonpowered 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
提示出问题的地方我用注释标记了20行处

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

#include <vcl.h>
#pragma hdrstop
#include <math.h>
#include <stdio.h>
#include "Caculater.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int temp1;
float temp2;
int flag;
//---------------------------------------------------------------------------

__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void__fastcall TForm1::FormCreate(TObject*Sender)/*这里提示出问题*/
{
Form1->Edit1->Clear();
temp1=0;
temp2=0;
flag=0;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button2->Caption;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button4Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button4->Caption;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button12Click(TObject *Sender)
{
form1->edit1->clear();
temp1=0;
temp2=0;
flag=0;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button1->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button3->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button5->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button6->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button7Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button7->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button8Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button8->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button9Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button9->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button10Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button10->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button13Click(TObject *Sender)
{
flag=1;
Temp1=StrToInt(Form1->Edit1->text);
Form1->Edit1->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button11Click(TObject *Sender)
{
Switch(flag)
{
case 1:temp2=StrToFloat(Edit1->text)+StrToFloat(temp1);
break;
case 2:temp2=StrToFloat(Edit1->text)-StrToFloat(temp1);
break;
case 3:temp2=StrToFloat(Edit1->text)*StrToFloat(temp1);
break;
case 4:temp2=StrToFloat(Edit1->text)/StrToFloat(temp1);
break;
}
Edit1->text=FloatToStr(temp2);

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button14Click(TObject *Sender)
{
flag=2;
Temp1=StrToInt(Form1->Edit1->text);
Form1->Edit1->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button15Click(TObject *Sender)
{
flag=3;
Temp1=StrToInt(Form1->Edit1->text);
Form1->Edit1->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button16Click(TObject *Sender)
{
flag=4;
Temp1=StrToInt(Form1->Edit1->text);
Form1->Edit1->Clear();
}
//---------------------------------------------------------------------------
...全文

相关推荐

PHP Parse Error: syntax error, unexpected $end 错误的解决办法

这几天写php程序,感觉很多地方不如asp,asp.Net,jsp顺手,比如session使用先得session_start();,文件跳转header用的也不方便…. 也许是不熟悉的php的一些特性吧,不过写多了,也就慢慢适应将就了….. 这里就整理一个代码编写调试问题,错误如下: Parse error: syntax error, unexpected $end in D:\xampp\htdocs\guestBook\guestBook.php on line 330 看看程序 330行,代码最后一行,这有什么错误?google搜,找到了: In PHP 5, the followin

weixin_38632624

PHP异常Parse error: syntax error, unexpected T_VAR错误解决方法

在PHP中根本不需要使用var声明的,但是当一个变量作为一个类的成员变量的时候,使用var还是没有问题的

weixin_38721405

c++错误解释(比较常见的错误类型)

普通的文字格式,用于初学者,在检查不出错误时可以借鉴,英语好者当然不用……

zw1051808917

PHP错误Parse error: syntax error, unexpected end of file in test.php on line 12解决方法

今天在写PHP程序的时候总是出现这样的错误:Parse error: syntax error, unexpected end of file in *.php on line *,然后我就根据提示,找到那个文件,然后错误中总是提示最后一行出错,我找到最后一行发现是&lt;/html&gt;,晕的,这能有什么错误,找了好久才找到问题所在,拿来分享。 出现这个错误的原因就是语法错误,肯定是PHP程序的书写不规范造成,我后来一条一条看才发现,原来是PHP语句标识符错了,正常情况下应该是这样的:&lt;?php 你的PHP语句?&gt;,我写成了这样:&lt;? 你的PHP语句?&gt;,当然写成这样也不错,只是我没有在php.ini

weixin_38650508

PHP syntax error, unexpected $end 错误的一种原因及解决

Parse error: syntax error, unexpected $end in script.php on line xx 调试了一会后发现产生错误的行是文件中间某行 //$str .= “?&gt;\n”; 想起来了 PHP 解释器允许的结尾标记那行还可以用单行注释,即 //$str .= “?&gt;\n”; 被解释成结尾标记前有注释,注释的内容是 //$str .= “,而 ?&gt; 后面的 \n”; 会被解释作 PHP 块外的内容按 HTML 输出出去!结果是给 $str .= “?&gt;\n”; 这行添加 // 成注释后,反而多了个 ?&gt; 的结束标记,造成原来真正的结束标记成了意料之外的(u

weixin_38535132
评论 5
收藏 已收藏
分享
返回顶部
pythonpowered
C++ Builder 13,871 成员 102,696 内容