1. ## My first program

Hi all,

I am creating a calculator with the ability to calculate speed, distance and time for my first program, and I am almost finished. I just have one problem:

The program starts with a selection menu, asking the user to enter 1, 2 or 3 to take them to the speed, distance and time calculators. I have the following code:

Code:
```#include <iostream>
using namespace std;

int main ()
{

// declaring variables:
float s, d, t, a;

// process:
s = 0;
d = 0;
t = 0;

a = 0;

start8:
cout << "Type 1 (speed), 2 (distance) or 3 (time) and press enter: ";
cin >> a;
if (a = 1)
goto start1;
if (a = 2)
goto One2;
if (a = 3)
goto Two3;```
With the code for each of the different calculators underneath, in the following setup:

Code:
```start1:
cout << "To get speed (m/s), enter distance (m), and press enter: ";
cin >> d;
cout << "To get speed (m/s), enter time (s), and press enter: ";
cin >> t;
s = d / t;
cout << "\n";
cout << "Speed (m/s) is: ";
cout << s;
cout << "\n";
cout << "\n";
goto start8;

one2:
cout << "To get distance (m), enter speed (m/s), and press enter: ";
cin >> s;
cout << "To get distance (m), enter time (s), and press enter: ";
cin >> t;
d = s * t;
cout << "\n";
cout << "Distance (m) is: ";
cout << d;
cout << "\n";
cout << "\n";
goto start8;

two3:
cout << "To get time (s), enter distance (m), and press enter: ";
cin >> d;
cout << "To get time (s), enter speed (m/s), and press enter: ";
cin >> s;
t = d / s;
cout << "\n";
cout << "Time (s) is: ";
cout << t;
cout << "\n";
cout << "\n";
goto start8;

return 0;
}```
The problem is that whether I enter one, two or three at the beginning of the program, I always get directed to the speed calculator. What do I need to do to be able to access the other two by entering 2 and 3 at the beginning?

Thanks.

2. Don't use goto, ever. There is no problem that cannot be solved without it, and it should be used as it creates spaghetti code that is near impossible to follow.

Take a look at your own code. I started reading it, and I saw: start8, goto start1, goto one2, goto two3.. How am I supposed to know where your code is going? Am I supposed to use the search function of my editor? You didn't even use descriptive names!

3. This is assignment.
Code:
`if (a = 1)`
`if (a == 1)`