Advertisement
Spocoman

08. Fuel Tank

Sep 4th, 2023
803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     string fuel;
  8.     cin >> fuel;
  9.  
  10.     double liters;
  11.     cin >> liters;
  12.  
  13.     fuel[0] = tolower(fuel[0]);
  14.  
  15.     if (fuel == "diesel" || fuel == "gasoline" || fuel == "gas") {
  16.         if (liters >= 25) {
  17.             cout << "You have enough " << fuel << "." << endl;
  18.         }
  19.         else {
  20.             cout << "Fill your tank with " << fuel << "!" << endl;
  21.         }
  22.     }
  23.     else {
  24.         cout << "Invalid fuel!" << endl;
  25.     }
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement