/*Copyright ElohimTov LLC*/ /* //Name: ElohimTov Solve Code - Operators - C++ Solution //Problem: HackerRank - 30 Days of Code - Operators //Current File: ElohimTovSolve_Operators.(cpp).txt //Compile-able File: ElohimTovSolve_Operators.cpp //Date: 11/05/2018 //Tale: ElohimTov Solve's Solution to HackerRank.com's // Operators problem, in C++ programming language. // Problem link at https://elohimtov.com/elohimtov.info. */ #include using namespace std; // Complete the solve function below. void solve(double meal_cost, int tip_percent, int tax_percent) { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ double tip, tax, totalCost; int hundred = 100; tip = (meal_cost * tip_percent)/hundred; tax = (meal_cost * tax_percent)/hundred; totalCost = meal_cost + tip + tax; cout << round(totalCost) << endl; return; }//ends solve function /* //CREDIT: The following main() function was provided by HackerRank.com */ int main() { double meal_cost; cin >> meal_cost; cin.ignore(numeric_limits::max(), '\n'); int tip_percent; cin >> tip_percent; cin.ignore(numeric_limits::max(), '\n'); int tax_percent; cin >> tax_percent; cin.ignore(numeric_limits::max(), '\n'); solve(meal_cost, tip_percent, tax_percent); return 0; }// ends main function /*Copyright ElohimTov LLC*/