cout << "n(" << x_coordinate1<< ","<< y_coordinate1<<") is "< cout << "nThe midpoint of the line segment from ("<< x_coordinate1 << ","<< y_coordinate1<<") and ("<< x_coordinate2<<"," << y_coordinate2<<") is ("< cout << "nDo you want to calculate another midpoint?" "y/n?"; cin >> answer; cin.ignore(INT_MAX,'n'); } cout << "nttThank you for using the 2PP!!nn";
cout << "nttEndeavor to have a day...!nn";
return 0; }
How can I add a menu to this program that prompts the user and asks for what the user needs specifically? I want it to look something like this:
Welcome to the Point Menu Program!!!
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit
Choice: n
I'm sorry, that choice is invalid!
Please try to read/type more carefully next time...
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit
Choice: m
Please enter two points before choosing this option!
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit
Choice: D
Please enter two points before choosing this option!
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit
Choice: e
1) enter First point 2) enter Second point 3) Nevermind...
Choice: e
I'm sorry, that choice is invalid!
Please try to read/type more carefully next time...
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit
Choice: E
1) enter First point 2) enter Second point 3) Nevermind...
Choice: F
Where is your first point? (3.4, 12.2)
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit
Choice: 3
Please enter two points before choosing this option!
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit
Choice: 1
1) enter First point 2) enter Second point 3) Nevermind...
Choice: 1
Where is your first point? (13.4, 12.2)
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit
Choice: M
Please enter two points before choosing this option!
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit
Choice: E
1) enter First point 2) enter Second point 3) Nevermind...
Choice: s
Where is your second point? (3.4, 12.2)
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit
Choice: M
The midpoint of the line segment from (13.4, 12.2) to (3.4, 12.2) is (8.4, 12.2).
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit
Choice: d
(13.4, 12.2) is 10 units away from (3.4, 12.2).
1) Enter point 2) calculate Distance between two points 3) calculate Midpoint of two points 4) Quit