This program is for converting from point slope form or two point form into slope intercept form based off of what the user wants. It also needs to prompt the user if they want to run it again. But it doesn't work passed prompting for which form they want to convert from.

Code:#include<stdio.h> #include<stdlib.h> #include<math.h> void get_problem(int *input); void get2_pt(double *x_1,double *y_1, double *x_2, double *y_2); void get_pt_slope(double *slope_pt_slope, double *y, double *x); void slope_intcpt_from2_pt(double x_1, double y_1, double x_2, double y_2, double *slope, double *intcpt); void intcpt_from_pt_slope(double x, double y, double slope_pt_slope, double *intcpt, double *slope); void display2_pt(double x_1,double y_1, double x_2, double y_2); void display_pt_slope(double slope, double x, double y); void display_slope_intcpt(double slope, double intcpt); int main(void) { char letter; int input; double x_1,y_1,x_2,y_2; double slope_pt_slope,x,y; double slope,intcpt; do{ get_problem(&input); switch(input){ case '1': get2_pt(&x_1,&y_1,&x_2,&y_2); slope_intcpt_from2_pt(x_1,y_1,x_2,y_2,&slope,&intcpt); display2_pt(x_1,y_1,x_2,y_2); display_slope_intcpt(slope,intcpt); break; case '2': get_pt_slope(&slope_pt_slope,&y,&x); intcpt_from_pt_slope(x,y,slope_pt_slope,&intcpt,&slope); display_pt_slope(slope,x,y); display_slope_intcpt(slope,intcpt); break; } printf("Do another conversion (Y or N) =>"); scanf("%c",&letter); }while(letter == 'Y' || letter == 'y'); } void get_problem(int *input){ printf(" \n"); printf("Select the form that you would like to convert to slope-intercept form:\n"); printf(" \n"); printf("1) Two-point form (you know two points on the line)\n"); printf(" \n"); printf("2) Point-slope form(you know the lines slope and first point)\n"); scanf("%d",&*input); } void get2_pt(double *x_1,double *y_1, double *x_2, double *y_2){ printf("Enter the x-y coordinates of the point separated by a space"); scanf("%lf %lf",&*x_1,&*y_1); printf("Enter the x-y coordinates of the point separated by a space "); scanf("%lf %lf",&*x_2,&*y_2); } void get_pt_slope(double *slope_pt_slope, double *y, double *x){ printf("Enter the slope"); scanf("%lf",&*slope_pt_slope); printf("Enter the x-y coordinates of the point separated by a space "); scanf("%lf %lf",&*x,&*y); } void slope_intcpt_from2_pt(double x_1, double y_1, double x_2, double y_2, double *slope, double *intcpt){ *slope = (y_2 - y_1) / (x_2 - x_1); *intcpt = ((*slope * (-x_1) + y_1)); } void intcpt_from_pt_slope(double x, double y, double slope_pt_slope, double *intcpt, double *slope){ *intcpt = (slope_pt_slope * (-x) + (-y)); *slope = slope_pt_slope; } void display2_pt(double x_1,double y_1, double x_2, double y_2){ printf("Two-Point Form"); printf("(%f - %f) / (%f - %f)",y_2,y_1,x_2,x_1); } void display_pt_slope(double slope, double x, double y){ printf("Point-Slope Form\n"); printf("y - %f = %f(x - %f",y,slope,x); } void display_slope_intcpt(double slope, double intcpt){ printf("Slope-Intercept Form\n"); printf("y = %f x + %f ",slope,intcpt); }