Hey guys, I recently started to learn c++ and I'm having trouble with writing a simple program to calculate the slope intercept form of a line equation given two points (with x and y coordinates). I was able to get the slope "m", the y intercept "b" but I am unable to get the line equation y=m*x+b. My source code is right below. (When I run it tells me invalid operands of types float and const to binary operator chars[2] for the last line). Thank you guys.
#include <iostream>
using namespace std;
int main()
{
float y1, y2, m, x1, x2, b;
char x, y;
cout<<"Enter first X: ";
cin>> x1;
cout<<"Enter second X: ";
cin>> x2;
cout<<"Enter first Y: ";
cin>> y1;
cout<<"Enter second Y: ";
cin>> y2;
m=(y2-y1)/(x2-x1);
cout<<"The slope is: "<< m <<"\n";
cin.get();
b=y1-(m*x1);
cout<<"The y intercept is: "<< b <<"\n";
cout<<"The line equation is: "<< y=m*x+b <<"\n";
I made a mistake, my last line was
cout<<''The line equation is: " <<y=m*x+b <<"\n";
Thank you for the answer but I do not understand what you are saying, I want my line equation to be on that form y=m*x+b, for example (y=3x+5).