/***************************************************************************** * Outputs the slope, midpoint, length of a line between two points. * * Inputed: [x1, y1], [x2, y2] (two points on the plane). * * Outputed: slope, midpoint, length. * * Written: October 18, 2001 * * By: Ronald Roberts * *****************************************************************************/ //Program 25 //18OCT01 #include #include #include int main() { /* declaration of variables */ double x1=0, x2=0, y1=0, y2=0, slope=0, mid1=0, mid2=0, length=0, b=0; /* instructions and user input */ cout<<"This program computes slope, midpoint, and length"<>x1>>y1; cout<<"Please enter the second point(x,y):"<>x2>>y2; /* calculation code */ if (x1==x2) { mid1=(x2+x1)/2; mid2=(y2-y1)/2; length=sqrt(pow((x2-x1), 2)+pow((y2-y1), 2)); b=y1-slope*x1; cout<<"The slope is UNDEFINED OR NULL SET ."<