diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1211bb6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: cpp +os: linux +script: + - make \ No newline at end of file diff --git a/Inventory.cpp b/Inventory.cpp index 57964b4..828dff6 100644 --- a/Inventory.cpp +++ b/Inventory.cpp @@ -4,7 +4,10 @@ using std::string; using std::ostream; +using std::cout; +using std::endl; +// Inventory class: name of item, price, amount Inventory::Inventory(string name, float price, int count) { m_name = name; @@ -12,9 +15,21 @@ Inventory::Inventory(string name, float price, int count) m_in_stock = count; } +// When user chooses to make a sale void Inventory::sell() { - m_in_stock--; + // Substract one from invetory after a sale. + if(m_in_stock > 0) + { + m_in_stock--; + } + + // When no inventory is left to sell, send error. + else + { + cout<<"Sorry, that item is out of stock\n"<"; cin>>choice; + // Take user input for Sell until user chooses to Quit if( choice == 'S' || choice == 's' ) { stock.sell();