PROGRAM CODE: TAXITURN (Gives correct output but still is not being accepted as a correct answer. Please check)

#include
#include
#include
#include<stdio.h>
#define PI 3.14159

using namespace std;

class Turns
{
int N;
int xa[50];
int ya[50];

public:
void input();
void calc();
};

void Turns::input()
{
cout<<“ENTER THE NUMBER OF MAPPING COORDINATES:”<<endl;
cin>>N;
do{
cout<<“ENTER AGAIN”<<endl;
cin>>N;

}while(N<3||N>50);
int x=-1;
int y=-1;
for(int i=0;i<N;i++){
    cout<<"ENTER COORDINATE"<<endl;
    cin>>x>>y;
    while((x<0||x>50)&&(y<0||y>50))
    {
        cout<<"WRONG DATA! ENTER AGAIN!"<<endl;
        cin>>x>>y;
    }
    xa[i]=x;
    ya[i]=y;
    }
}

void Turns::calc()
{
    int c=0;
    int a,b;
    a=1;
    b=3;
    while(b<=N)
    {
        int t=(a+b)/2;
        double s1=(ya[t-1]-ya[a-1])/(xa[t-1]-xa[a-1]);
        double s2=(ya[b-1]-ya[t-1])/(xa[b-1]-xa[t-1]);

        if((abs(atan(s1)-atan(s2))*180/PI)>45)
        {
            c=1;
            break;
        }
        else
        {
            a++;
            b++;
            continue;
        }
    }

    if(c==1)
        cout<<"SHARP TURN!";
    else
        cout<<"NO!";

}



int main()
{
    int T;
    cout<<"ENTER THE NUMBER OF TEST CASES:"<<endl;
    cin>>T;
    Turns ob;
    cin.ignore();
    for(int i=1;i<=T;i++)

    {
        cout<<"TEST CASE :"<<i<<endl;
        ob.input();
        ob.calc();
    }
    return 0;
}

Hey
You should not give any outputs like “ENTER THE NUMBER OF TEST CASES:” , “ENTER COORDINATE” etc.

Judge considers it as an output, while comparing your output with the correct answer and that is the reason you are getting a wrong answer. So try removing such instructions and submit your code.

Also you should not use “WRONG DATA! ENTER AGAIN!” because constraints that are mentioned in the question will be followed strictly in the test cases.

Thanks indeed! Will surely help me. :slight_smile: