Курсовая работа: Система обработки научных данных
float varx = sqrt(sum5/n);
float vary = sqrt(sum6/n);
float coeff = ((cov/varx)/vary);
cout<<" THE COEFFICIENT OF CORRELATION = "<<coeff<<endl<<endl;
if(coeff<=1 && coeff>= -1)
{
if(coeff == -1)
cout<<" There is perfect negative correlation between X and Y\n";
else if(coeff ==1)
cout<<"There is perfect positive correlation between X and Y\n";
else if(coeff ==0)
cout<<" There is no correlation between X and Y\n";
else if (coeff<0)
cout<<" There is negative correlation between X and Y\n";
else if (coeff>0)
cout<<"There is positive correlation between X and Y\n";
}
else
cout<<"There seems to be a mistake in the data provided since the value of coefficient of correlation does not lie between -1 and 1";
break;
}
default:
{ outtextxy(30,midy +100," Sorry, you have entered the wrong choice");
getch();
cleardevice();
corre();
break;
}
}