Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:为什么我这段代码用C++提交才可以,C就不行(错误原因说是标识符未声明)

Posted by SummerJY at 2014-04-20 12:46:47 on Problem 1005
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator