1. Write a C++ program that prompts the user for the fuel quantity and the fuel price
per litr
#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');
}
Comments
Leave a comment