Tip Calculator

Published on: August 1, 2010

This is just another video in the Easy Programming series. Here I show you a little more complex program using C++ (Microsoft Visual Studio 2008) where you can calculate your total bill, tip, as well as how much you may be splitting the bill for. There are more variables, more equations and it's still a great tutorial for any beginner starting up.

Remember to checkout the Codesnip below to review the C++ code yourself! Feel free to copy the code, but I ask that you please provide credit if you leave the code unchanged when you use it.


//Programmer: Nazmus
//Program:  Tip Calculator
//Website:  EasyProgramming.net

using namespace std;

void main()
 int people; 
 float bill, tip, totaltip, total; 

 cout << "How much is the bill? ";
 cin >> bill;
 cout << "How many people will be splitting the bill? ";
 cin >> people; 
 cout << "What is the percentage of the tip? ";
 cin >> tip;

 totaltip = bill * (tip/100.); 
 total = (totaltip + bill)/people;

 cout << endl;
 cout << "The total tip at " << tip << "% is $" << totaltip << '.' << endl;
 cout << "Each person will pay $" << total << '.' << endl;