#include <iostream>
using namespace std;
int main()
{
int x1;
int y1;
int x2;
int y2;
cout<< "\f";
cout<<"This program will calculate the slope of the two coordinates you put in."<<endl;
cout<<"For your first pair of coordinates, enter in your \"x\" coordinate ";
cin>> x1;
cout<<endl;
cout<< "\f";
cout<<"Now enter in your \"y\" coordinate ";
cin>> y1;
cout<<endl;
cout<< "\f";
cout<<"Then for your second pair of coordinates, enter in your \"x\" coordinate ";
cin>> x2;
cout<<endl;
cout<< "\f";
cout<<"Finally, enter in your \"y\" coordinate ";
cin>> y2;
cout<<endl;
How would I do y2-y1 and x2-x1 before it would divide? Are there grouping symbols I can use to indicated which one should go first? How would I do that?
However, you will be surprised by the result. Because you defined x1, y1, x2 and y2 as integers, the division operation will be integer division. You will get an integer result, and the "remainder" will be discarded. You need to cast one of the operands to a floating point value in order to perform floating point division in order to get the real-number value you would expect. You can use floator doublefor this purpose.