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

Discussion of Problem 1413. Mars Jumper

CompError
Posted by MiR 15 Aug 2006 10:58
Why I have comperror? Deleting <math.h> gives nothing.

#include <iostream.h>
#include <math.h>
//#include <fstream.h>
const int MaxN = 1000001;
//const double koef== 0.70710678119;
int main()
{//ifstream in("c:/input.txt", ios::in);
double koef;
koef=sqrt(2.0);
koef/=2;
char a[MaxN]="";
//cin.getline(a, MaxN);
int i=0;
while (cin.get(a[i]));
double x=0.,y=0.;
char* pa=a;
while (*pa && *pa!='0')
  {if (*pa=='9') {x+=koef;y+=koef;}
  if (*pa=='8') {x-=koef;y+=koef;}
  if (*pa=='7') {x++;y++;}
  if (*pa=='6') {x++;}
  if (*pa=='4') {x--;}
  if (*pa=='3') {x+=koef;y-=koef;}
  if (*pa=='2') {x--;y--;}
  if (*pa=='1') {x-=koef;y-=koef;}
  pa++;
  }
//cout.precision(10);
//cout<<fixed<<x<<" "<<y;
printf("%.10lf",x);
cout<<" ";
printf("%.10lf",y);
return 0;
}
Re: CompError
Posted by Vladimir Yakovlev (USU) 15 Aug 2006 11:21
Change
#include <iostream.h>
to
#include <iostream>
using namespace std;

or add
#include <stdio.h>

AND READ FAQ BEFORE POSTING HERE!