ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

Please, explain me, why I have CE with this code? (C++)
Posted by Bahturin Alexander (SibSUTI#2) 10 Dec 2005 17:54
I tried to get results by e-mail but no letter was sent to mine... So I cannot understand why I have CE? I'll be very pleased for any help, because I have not idea at all...


#include <stdlib.h>
#include <stdio.h>
#include <iostream.h>
#include <math.h>

long V, a;
double K, arad;

void Load(){
     freopen("input.txt", "r", stdin);
     cin >> V >> a >>K;
     arad = a * M_PI / 180;

     fclose(stdin);
}

void Solve(){
     double S = 0, l, t;
     double SqrtK = sqrt(K);
     double Vx = V * cos(arad), Vy = V * sin(arad), g = 10;

     freopen("output.txt", "w", stdout);

     while (true){
           t = 2 * Vy / g;
           l = Vx * t;
           S += l;
           Vx /= SqrtK;
           Vy /= SqrtK;
           if (l < 0.00001) break;
     }
     printf("%.2f", S);
     fclose(stdout);
}

int main()
{
    Load();
    Solve();
    return 0;
}
Re: Please, explain me, why I have CE with this code? (C++)
Posted by Vladimir Yakovlev (USU) 14 Dec 2005 02:40
'M_PI' : undeclared identifier

and comment the string
freopen("input.txt", "r", stdin);