1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double findSlope(double, double, double, double); //function prototype
int main()
{
double x1,y1,x2,y2,slope;
cout<<"Please input the values for x1, y1, x2, and y2"<<endl;
cin>> x1, y1, x2, y2;
slope = findSlope(x1, y1, x2, y2); // call the function
cout<<"The slope between the two given points is "<<slope<<endl;
return 0;
}
double findSlope(double x1 ,double y1 ,double x2 ,double y2 )
{
double slope;
slope = (y2-y1)/(x2-x1);
system ("pause");
return slope;
}
|