| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:为什么我这段代码用C++提交才可以,C就不行(错误原因说是标识符未声明)In Reply To:Re:为什么我这段代码用C++提交才可以,C就不行(错误原因说是标识符未声明) Posted by:SummerJY at 2014-04-20 12:45:45 好像知道了
变量都声明在循环外面就可以。
#include<stdio.h>
const double PI=3.141592654;
int main()
{
//freopen("input.txt","r",stdin);
int n;
int i=1;
double Area;
int year;
double x,y;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%lf%lf",&x,&y);
Area=0.5*PI*(x*x+y*y);
year=(int)(Area/50.0+1.0);
printf("Property %d: This property will begin eroding in year %d.",i,year);
printf("\n");
}
printf("END OF OUTPUT.");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator