### Can anyone help with a while loop?

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.

 ``1234567891011121314151617181920212223242526272829303132`` ``````// 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 using namespace 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 <<")"<
http://programming.msjc.edu/cpp/4Repetitionnbsp;nbsp;nbsp;.aspx#LiveTabsContent2875151-lt

Follow that section, that should help you understand how to do for, while, and do while loops.
Topic archived. No new replies allowed.