Advertisement
Marcos510

Untitled

Apr 5th, 2020
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     string date, rest_name, street_and_city;
  8.     double bill, tax_rate, tip, final_bill;
  9.     int num_people;
  10.  
  11.     srand(time(NULL));
  12.     tip = rand() % (21 - 15) + 15;
  13.     cout << "the tip amount is: " << tip << endl;
  14.  
  15.     cout << "Enter date: ";
  16.     getline(cin,date);
  17.     cout << date << endl;
  18.  
  19.     cout << "Enter restaurant name: ";
  20.     getline(cin,rest_name);
  21.     cout << rest_name << endl;
  22.  
  23.     cout << "Enter street and city: ";
  24.     getline(cin,street_and_city);
  25.     cout << street_and_city << endl;
  26.  
  27.     cout << "Enter bill amount: ";
  28.     cin >> bill;
  29.  
  30.     cout << "Enter tax rate in %: ";
  31.     cin >> tax_rate;
  32.  
  33.     cout << "Enter number of people to divide by: ";
  34.     cin >> num_people;
  35.  
  36.     final_bill = bill + tax_rate;
  37.  
  38.     cout << "\nPress any key to continue. ";
  39.     system("pause");
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement