Question: Can you help me answer these questions in relation to my code listed below? #include #include #include #include using namespace std; int main() { cout

Can you help me answer these questions in relation to my code listed below?

#include

#include

#include

#include

using namespace std;

int main()

{

cout

string choice;

/* looping the menu */

do{

string line1,line2;

double firstPointStart,firstPointEnd;

double secondPointStart,secondPointEnd;

/*displaying the menu*/

cout

cout

cout

cin>>choice;

/*converting choice to lower case*/

transform(choice.begin(), choice.end(), choice.begin(), ::tolower);

/* if choice equal to

1 or mid or MID or MiD mID */

if(choice=="1"||choice=="mid")

{

//asking the input

/*input in form of second> 34 32*/

cout

cin.ignore(256, ' ');

getline(cin,line1);

cout

getline(cin,line2);

stringstream ss1(line1);

stringstream ss2(line2);

string temp;

int i=0,j=0;

//manupulatin the line

while(getline(ss1,temp,' '))

{

if(i==0)

firstPointStart=stod(temp);

if(i==1)

{

firstPointEnd=stod(temp);

}

i++;

}

while(getline(ss2,temp,' '))

{

if(j==0)

secondPointStart=stod(temp);

if(j==1)

{

secondPointEnd=stod(temp);

}

j++;

}

//calculating the midpoint

cout

}

/* if choice equal to

2 or dis or DIS or Dis dIS */

else if(choice=="2"||choice=="dis")

{

cout

cin.ignore(256, ' ');

getline(cin,line1);

cout

getline(cin,line2);

stringstream ss1(line1);

stringstream ss2(line2);

string temp;

int i=0,j=0;

while(getline(ss1,temp,' '))

{

if(i==0)

firstPointStart=stod(temp);

if(i==1)

{

firstPointEnd=stod(temp);

}

i++;

}

while(getline(ss2,temp,' '))

{

if(j==0)

secondPointStart=stod(temp);

if(j==1)

{

secondPointEnd=stod(temp);

}

j++;

}

cout

}

/* if choice equal to

3 or quit or QUIT or QuiT quIT */

else if(choice=="3"||choice=="quit")

{

cout

break;

}

//any invalid input comes here

else{

cout

}

}

while(true);

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!