Answer to Question #327663 in C++ for Sabic

Question #327663

1. Write a C++ program that prompts the user for the fuel quantity and the fuel price 

per litr


1
Expert's answer
2022-04-12T13:26:49-0400
#include<iostream>


using namespace std;


int main()
{
	float fuelQuant;
	float fuelPrice;
	char ch;
	do
	{
		cout << "Please, enter a fuel quantity: ";
		cin>> fuelQuant;
		cout << "Please, enter a fuel price: ";
		cin >> fuelPrice;
		cout << "\nFuel quantity is " << fuelQuant;
		cout << "\nFuel price is " << fuelPrice;
		cout << "\nFull price is " << fuelQuant*fuelPrice;
		cout << "\nDo you want to continue? [Y/N]:";
		cin >> ch;
	} while (ch == 'Y');
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS