Remember to checkout the Codesnip below to review the C++ code yourself! Feel free to copy the code, but I ask that you please provide credit if you leave the code unchanged when you use it.
//Programmer: Nazmus //Program: Midpoint-Slope //Purpose: Get Midpoint and the Slope of a line //Website: EasyProgramming.net #include <iostream> using namespace std; void main() { float x1, x2, y1, y2, midpoint1, midpoint2, slope; cout << "This program will help you calculate the Midpoint & Slope of a line." << endl<<endl; cout << "Please input the value of the first point, x1 & y1 with a space in between: "; cin >> x1 >> y1; cout << "Thank you, please input the value of the second point: "; cin >> x2 >> y2; midpoint1 = (x1 + x2) / 2; midpoint2 = (y1 + y2) / 2; slope = (y2 - y1) / (x2 - x1); cout <<endl<< "The slope of the line is " << slope << '.' << endl << endl; cout << "The midpoint of the line is (" << midpoint1 << ", " << midpoint2 << ")." << endl <<endl; cout << "Thanks for using this program." << endl; system("pause"); }