首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

ACM Compilation Error,该如何解决

2012-11-05 
ACM Compilation Error这是我变得程序,在VC里能运行。但是在OJ上却通不过。大家帮我看下 哪错了#include st

ACM Compilation Error
这是我变得程序,在VC里能运行。但是在OJ上却通不过。
大家帮我看下 哪错了
#include "stdafx.h"
#include"iostream"
using namespace std;

int main()
{
int N;
float x,y,z;
cin>>N;
int i;
for(i=0;i<N;i++)
{
cin>>x>>y;
  z=(3.14*(x*x+y*y))/100;
cout<<"Property "<<i+1<<": This property will begin eroding in year "<< (int)(z+1)<<"."<<endl;
 

}
cout<<"END OF OUTPUT."<<endl;


return 0;
}
OJ地址:http://acm.nuc.edu.cn/OJ/problem.php?pid=1001

[解决办法]
是不是这个啊?
#include "stdafx.h"
不是那里都有的啊,MFC的玩意,全称 Standard Application Framework Extensions.

写成这样好点:

C/C++ code
#include <iostream>using namespace std;int main(){    int N;    float x,y,z;    cin>>N;    int i;    for(i=0;i<N;i++)    {        cin>>x>>y;        z = (float)(3.14*(x*x+y*y))/100;        cout<<"Property "<<i+1<<": This property will begin eroding in year "<< (int)(z+1)<<"."<<endl;    }    cout<<"END OF OUTPUT."<<endl;    return 0;} 

热点排行