I missed class on the days we did it and am completely lost on it. We need to modify a previous code we did and add a while loop to it. The original code is here, we need to add a while loop to be able to execute it at least 6 times. Also this code works it just needs a while loop added which I have no idea what it is. Thanks in advance.
// This is a program that when given the x and y coordinates of two points on a line,
// the program calculates and displays the slope and the midpoint of that line.
#include <iostream>
usingnamespace std;
int main()
{
double x1=0;
double x2=0;
double y1=0;
double y2=0;
double slope=0;
double midpoint=0;
//prompt
cout << "Please enter the x coordinate of the first point on a line:" ;
cin >> x1;
cout << "Please enter the y coordinate of the first point on a line:" ;
cin >> y1;
cout << "Please enter the x coordinate of the second point on the line:" ;
cin >> x2;
cout << " Please enter the y coordinate of the second point on the line:" ;
cin >> y2;
slope=(y2-y1)/(x2-x1);
midpoint=((x1+x2)/2);
midpoint=((y1+y2)/2);
cout << "The first point's coordinate is:""("<< x1 <<","<< y1 <<")"<<endl;
cout << "The second point's coordinate is:""("<< x2 <<","<< y2 <<")"<<endl;
cout << "The slope of the line is: ("<< slope <<")"<<endl;
cout << "The midpoint is: ("<< midpoint <<")"<<endl;
system("pause");
return 0;