Is this a good pseudocode and can you help me write this, I am kind of new to programming.
if (choice > 0 && choice < 4) //choice is between 0 and 4
{
cout << "Enter the distance: \n"; //displays the distance
cin >> distance; //prints the distance
if (distance > 0)
{
cout << "A sound wave takes "; //displays the amount of time it takes a sound wave to travel
cout << fixed << setprecision(4);
switch (choice) //
{
case 1: cout << distance / A << " seconds to travel " << distance << " feet through air.\n";
break;
case 2: cout << distance / W << " seconds to travel " << distance << " feet through water.\n";
break;
case 3: cout << distance / S << " seconds to travel " << distance << " feet through steel.\n";
break;
}
}
else
{
cout << "Distance must be greater than zero."; //displays that distance must be greater than zero
}
}
else
{
cout << "The valid choices are 1 through 3. Run the program again and select one of those.";
} //choice must be either 1,2,3 and if not, run the program again
system("pause"); //pause
return 0;
}