fork download
  1. #include<iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. cout << setprecision(2) << fixed;
  9. string fname, sname, tname;
  10. float bill, tip;
  11. cout << "Enter first friend name: ";
  12. cin >> fname;
  13. cout << "\nEnter second friend name: ";
  14. cin >> sname;
  15. cout << "\nEnter third friend name: ";
  16. cin >> tname;
  17. cout << "\nEnter amount of bill: $";
  18. cin >> bill;
  19. tip = 0.15*bill;
  20. cout << "\n\nTip amount:\t$" << tip;
  21. cout << "\nTotal bill:\t$" << tip + bill;
  22. cout << "\n\n" << fname << ":\t$" << (tip + bill) / 3;
  23. cout << "\n" << sname << ":\t$" << (tip + bill) / 3;
  24. cout << "\n" << tname << ":\t$" << (tip + bill) / 3;
  25. return 0;
  26. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Enter first friend name: 
Enter second friend name: 
Enter third friend name: 
Enter amount of bill: $

Tip amount:	$0.00
Total bill:	$0.00

:	$0.00
:	$0.00
:	$0.00