新手求指教 代码错误

sic_toy 2015-04-16 04:24:26
#include <iostream>;
using namespace std
int main ()
{
float a,b,c;//three data
float median;// data to deposit the number in the middle
float max;//data to deposit the biggest number
float min;//data to deposit the smallest numeber
bool dateAreok;//date to judge if the number that client input is legal
cout <<"Please enter three different numbers."<<endl;//prompt client to enter three number
cin>>a>>b>>c;//enter numbers
if (a==b||b==c||a==c)
dateAreok=false;
else dateAreok=true;
if (ateAreok){
if(a>b){
max=a;
min=b;}
else {
max=b;
min=a;}
if(c>max){
median=max;
max=c;}
else if(c<min){
median=min;
min=c;}
else c=median;
cout<<"The median of"<<a<<,<<b<<,<<c<<"is"<<median<<"."<<endl;
}
else
cout<<"Please enter three different numbers"<<endl;
return 0;
}

错误代码e:\c++\practise1.cpp(1) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
e:\c++\practise1.cpp(3) : error C2144: syntax error : missing ';' before type 'int'
e:\c++\practise1.cpp(3) : fatal error C1004: unexpected end of file found

求教大神 请帮忙修改
顺便请问有什么工具可以及时发现代码语法错误吗。
...全文
114 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
zeroyetj 2015-04-16
  • 打赏
  • 举报
回复
你这错误好多啊 一是你判断的时候变量写错了 二是你判断后的执行语句也有错的 三是字符的打印 至于什么分号的位置我就不说 了 就这些了
zeroyetj 2015-04-16
  • 打赏
  • 举报
回复
下面打印命令的 ’ 字符也应该引起来
zeroyetj 2015-04-16
  • 打赏
  • 举报
回复
你有一个if语句的判断变量不存在
sic_toy 2015-04-16
  • 打赏
  • 举报
回复
ompiling... practise1.cpp E:\C++\practise1.cpp(2) : error C2018: unknown character '0xa3' E:\C++\practise1.cpp(2) : error C2018: unknown character '0xbb' E:\C++\practise1.cpp(3) : error C2144: syntax error : missing ';' before type 'int' E:\C++\practise1.cpp(3) : fatal error C1004: unexpected end of file found 执行 cl.exe 时出错. practise1.obj - 1 error(s), 0 warning(s) 就是这个样子
fight2old 2015-04-16
  • 打赏
  • 举报
回复
你改了上面的后面提示什么错误啊
sic_toy 2015-04-16
  • 打赏
  • 举报
回复
还是不行 求帮助
fight2old 2015-04-16
  • 打赏
  • 举报
回复
#include <iostream>;多了个分号
fight2old 2015-04-16
  • 打赏
  • 举报
回复
using namespace std漏了分号
sic_toy 2015-04-16
  • 打赏
  • 举报
回复
表示看不懂......
赵4老师 2015-04-16
  • 打赏
  • 举报
回复
偶遇到类似问题都是用 “每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。” 的方法解决的。

64,683

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧