Westonci.ca connects you with experts who provide insightful answers to your questions. Join us today and start learning! Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform. Our platform offers a seamless experience for finding reliable answers from a network of knowledgeable professionals.

Driving is expensive. Write a program with two inputs, a car's miles/gallon and the cost of gas/gallon both represented as double variables, and output the total drive cost for 10 miles, 50 miles, and 400 miles, all on the same line, each separated by a single space.

Output each floating-point value with two digits after the decimal point, which can be achieved by executing the command
cout << fixed << setprecision(2); once before all other cout statements. That is done only once in the code before any cout stamtent.

Ps:(when i run the program it says this-
Enter miles per Gallon:
Gas cost for ten miles :-nan
Gas cost for fifty miles :-nan
Gas cost for four hundred miles:-nan