I've had some great responses on this website for other queries.
I've written the code below but I can't understand why it is not executing.
The objective is to write the following steps:
If the console is abruptly closing as soon as you give your input, see http://www.cplusplus.com/forum/beginner/1988/
A good IDE should let you keep the console window open after execution automatically, otherwise follow the suggestions Duoas gave in that thread.
You can always test your code online at ideone.com or cpp.sh
Please indent your code properly and put code tags around it using the toolbox <> on the right. We can run it using the gear wheel when you do that in future posts. :)
Running it this way gives the following output:
Enter b in metres: 2
Enter h1 in metres: 3
Enter L in metres. 5
Enter Ps in metres. 2
0.83
0.70384
Q = 12.4713
Exit code: 0 (normal program termination)
Ganado, I took a look at the website http://cpp.sh/ and enter the code into the C++ Shell.
As you mentioned the code runs in the shell. so the code is okay.
Thanks kemort, I'll tidy up my C++ code in the future.