|
|
back to boardCompError 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 Change #include <iostream.h> to #include <iostream> using namespace std; or add #include <stdio.h> AND READ FAQ BEFORE POSTING HERE! |
|
|