3D DISTANCE CALCULATOR(EUCLIDEAN/MANHATTAN/CHEBYSHEV)

I got as far as this and then I lost my way.

#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;

int x1 = 0;
int x2 = 0;
int y1 = 0;
int y2 = 0;
int distance = 0;
int choice;




int main()
{
cout <<"========3D Distance Calculator=========="<< endl;
cout <<"[1] Change the first point" << endl;
cout <<"[2] Change the second point"<< endl;
cout <<"[S/s] Display the current two points"<< endl;
cout <<"[E/e] Calculate and display the Euclidean Distance between the two points"<< endl;
cout <<"[M/m] Calculate and display the Manhattan Distance between the two points"<< endl;
cout <<"[C/c] Calculate and display the Chebyshev Distance between the two points"<< endl;
cout <<"[Q/q] Quit the program\n\n";
cout <<"Enter your choice : \n" << endl;
cin >> choice;

if(choice = 1)
if(choice = 2)

if(choice = S || s){
cout << distance << endl;
}

if(choice = E || e) {
double x1, y1, x2, y2;
double dist;
cout<<"Enter x value of first coordinate "<<endl;
cin>>x1;
cout<<"Enter y value of first coordinate "<<endl;
cin>>y1;
cout<<"Enter x value of second coordinate "<<endl;
cin>>x2;
cout<<"Enter y value of second coordinate "<<endl;
cin>>y2;

dist = distanceCalculate(x1, y1 , x2, y2);
cout<<"Distance Between ("<<x1<<" , "<<y1<<") and ("<<x2<<" , "<<y2<<") = "<<dist;

}

if(choice = M || m)
if(choice = C || c)

if(choice = Q || q){
break;
}


system("PAUSE");
return 0;
}

double distanceCalculate(double x1, double y1, double x2, double y2)
{
double x = x1 - x2;
double y = y1 - y2;
double dist;

dist = pow(x,2)+pow(y,2);
dist = sqrt(dist);

return dist;
}
it requires the use of a switch statement. Given that I am a beginner, incorporating three different formulas for several cases is a bit confusing to me
Revised edition with the switch statement.

#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;

int x1 = 0;
int x2 = 0;
int y1 = 0;
int y2 = 0;
int distance = 0;
int choice;




int main()
{
cout <<"========3D Distance Calculator=========="<< endl;
cout <<"[1] Change the first point" << endl;
cout <<"[2] Change the second point"<< endl;
cout <<"[S/s] Display the current two points"<< endl;
cout <<"[E/e] Calculate and display the Euclidean Distance between the two points"<< endl;
cout <<"[M/m] Calculate and display the Manhattan Distance between the two points"<< endl;
cout <<"[C/c] Calculate and display the Chebyshev Distance between the two points"<< endl;
cout <<"[Q/q] Quit the program\n\n";
cout <<"Enter your choice : \n" << endl;
cin >> choice;

switch(distance){
case 1:
case 2:
case S || s:
case E || e: {
double x1, y1, x2, y2;
double dist;
cout<<"Enter x value of first coordinate "<<endl;
cin>>x1;
cout<<"Enter y value of first coordinate "<<endl;
cin>>y1;
cout<<"Enter x value of second coordinate "<<endl;
cin>>x2;
cout<<"Enter y value of second coordinate "<<endl;
cin>>y2;

dist = distanceCalculate(x1, y1 , x2, y2);
cout<<"Distance Between ("<<x1<<" , "<<y1<<") and ("<<x2<<" , "<<y2<<") = "<<dist;
}//end case E || e

case M || m:{

}//end case M || m

case C || c:{
}//end case C || c

case Q || q:
break;
}





system("PAUSE");
return 0;
}


double distanceCalculate(double x1, double y1, double x2, double y2)
{
double x = x1 - x2;
double y = y1 - y2;
double dist;

dist = pow(x,2)+pow(y,2);
dist = sqrt(dist);

return dist;
}
Topic archived. No new replies allowed.