For this example, we're going to add calculate the total of two purchases.
#include <pecunia/Codes.h>
#include <pecunia/Money.h>
int main(int argc, char* argv[])
{
// Create the first purchase for $15.55. Note the cents must be put in the form of the minor
// units (cents) plus the extra precision used in complex currency calculations.
const pecunia::currency::Money purchase0{pecunia::currency::Currency::USD, 15, 55};
// Create the second purchase.
const pecunia::currency::Money purchase1{pecunia::currency::Currency::USD, 30, 45};
// Create an object to store the total in, using a constructor that initialises to zero.
pecunia::currency::Money total{pecunia::currency::Currency::USD};
// Perform the calculation.
total = purchase0 + purchase1;
// Total now contains the total of $46.00.
return 0;
}