注册 登录
编程论坛 C++教室

我写的代码改了好久 ,结果还有5处错误,能给我看看吗,门外汉的痛啊

liu609 发布于 2015-04-19 19:44, 1121 次点击
#include<math.h>
#include<stdio.h>
main()
{
double s,h,p,p1,p0,a,v,w,p2;
w=215*3.14/30,h=30,p0=90,p1=90,p=0,p2=190;
for(p=0;p<=190;p=p+5)
{if(0<=p&&p<=45)
{s=2*h*p*p/p0*p0,v=4*h*w*p/p0*p0,a=4*h*w*w/p0*p0;}
else
{if(45<p&&p<=90)
s=(h-2*h*(p0-p)*(p0-p))/p0*p0,v=4*h*w*(p0-p)/p0*p0,a=-4*h*w*w/p0*p0;}
else
if(100<=p&&p<=145)
{s=(h-2*h*(p-100))/p0*p0,v=-4*h*w*(p-100)/p0*p0,a=-4*h*w*w/p0*p0;}
else
{if(145<p&&p<=190)
s=2*h*(p2-p)*(p2-p)/p0*p0,v=-4*h*w*(p2-p)/p0*p0,a=4*h*w*w/p0*p0;}}
printf("/n%d,/n%d,/n%d",a,v,s);}


就这样的--------------------配置: mingw5 - CUI Debug, 编译器类型: MinGW--------------------

检查文件依赖性...
正在编译 C:\Users\liu-\Documents\C-Free\Projects\1\main.cpp...
[Warning] D:\迅雷下载\C-Free 5\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\backward\backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
[Error] g++.exe: 5\mingw\include: No such file or directory
[Error] g++.exe: 5\mingw\include\c++\3.4.5: No such file or directory
[Error] g++.exe: 5\mingw\lib\gcc\mingw32\3.4.5\include: No such file or directory
[Error] g++.exe: 5\mingw\bin\: No such file or directory
[Error] g++.exe: 5\mingw\mingw32\bin\: No such file or directory

构建中止 main: 5 个错误, 1 个警告
9 回复
#2
宇智波鼬1232015-04-19 20:50
不知道你的为啥那么多错误,我只是把你的粘贴代码复制到我新创建的源文件中编译只是显示一个错误,显然你得主体程序是void main(前提是你不返回值);例外else在这里是多余的这个最基本的条件语句你都搞错了,还是多看看c++书籍吧。这一下你改完之后全部组建一下在编译看有没有错误;
#3
zcdjt2015-04-19 20:57
main()函数没类型,表达式后标点符号是;
#4
liu6092015-04-20 09:34
回复 2楼 宇智波鼬123
谢谢  谢谢
#5
小狼烟2015-04-20 11:27
没搞懂你要干啥啊,循环了那么多次就输出了一次?是不是逢5就按公式计算一次输出呢。。
#6
yangfrancis2015-04-21 07:30
三楼正解
#7
nnnnnnn6662015-04-25 07:24
回复 6楼 yangfrancis
赋值方面太绕了吧。醉了
#8
wmf20142015-04-25 10:15
你这不需要c++,就设置成c控制台程序即可。我编译的一个else无if错误,另格式混乱。未判断你功能实现的正确性。
#9
hzj1996032015-04-30 20:44
回复 楼主 liu609
if else在这个程序里,没看出来else有什么用
还有printf("/n%d,/n%d,/n%d",a,v,s);真的是/不是\么?
#10
xzlxzlxzl2015-04-30 23:55
好像是指定的目录没有你需要的头文件。
1