Code:
#include<stdio.h>
void get_problem(void);
void get_2pt(void);
void display2_pt(void);
void display_slope_intcpt(void);
void get_pt_slope(void);
void slope_intcpt_from2_pt(void);
void intcpt_from_pt_slope(void);
void display_pt_slope(void);
int
main(void)
{
char any_char;
do
{
double n1, slope, x1, y1, x2, y2, b;
get_problem();
if(n1 == 1){
get_2pt();
display2_pt();
slope_intcpt_from2_pt();
display_slope_intcpt();
}else if(n1 == 2){
get_pt_slope();
display_pt_slope();
intcpt_from_pt_slope();
display_slope_intcpt();
}
printf("\nDo you wish to calculate another vector sum?(Y/N)\n");
scanf(" %c", &any_char);
}
while((any_char == 'y') || (any_char == 'Y'));
return(0);
}
void
get_problem(double &n1)
{
printf("Select the form that you would like to convert to slop-intercept form:/n");
printf("1. Two-point form (you know two points on the line)/n");
printf("2. Point-slope form (you know the line's slope and one point)/n");
scanf(" %lf", &n1);
}
void
get_pt_slope(double *slope, *x1, *y1)
{
printf("Enter the slope =>");
scanf(" %lf", &slope);
printf("\nEnter the x-y corrdinates of the point separated by a space =>");
scanf(" %lf%lf", &x1, %y1);
}
void
slope_intcpt_from2_pt(double *m, x1, x2, y1, y2)
{
m = (y2 - y1)/(x2 - x1)
}
void
display_pt_slope(double m, y1, x1)
{
printf("Point-Slope form: \n")
printf("y - %f = %f(x - %f)", &y1, &m, &x1)
}
void
display_slope_intcpt(double slope, b)
{
printf("\nSlope-intercept form:\n");
printf("y = %fx + %f", &slope, &b);
}
void
display_2pt(double y1, y2, x1, x2)
{
printf("Two-point form: \n");
printf(" (%f - %f)\n", &y2, &y1);
printf("m = ---------\n");
printf(" (%f - %f)\n", &x2, &x1);
}
void
get_2pt(double x1, x2, y1, y2)
{
printf("Enter the x-y corrdinates of the first point separated by a space =>")
scanf("%f%f", &x1, &y1)
printf("Enter the x-y corrdinates of the second point separated by a space =>")
scanf("%f%f", &x2, &y2)
}
void
intcpt_from_pt_slope(double &b)
{
b = m*x1 + y1
}
error:
[C++ Error]Unit1.c(60): E2293 ) expected