The program is meant to convert a USD($) quantity inputted by the user (from $0 to $10 max) and output it in quantities of quarters, dimes, nickles, and pennies. #include <iostream> const double QUARTER {0.25}; const double DIME {0.10}; const double NICKLE {0.05}; const double PENNY {0.01}; void dollarToCoin(double cash, unsigned short& quarters, unsigned short& ..

#### Category : arithmetic-expressions

I was trying to solve this exercise: https://www.codeabbey.com/index/task_view/fahrenheit-celsius However, here is the solution: #include <iostream> using std::cout; using std::cin; int main() { int n, a; cin >> n; int* answers = new int[n]; // allocating memory for (int i = 0; i < n; i++) { cin >> a; answers[i] = (a – 32) * ..

I’m trying to make a specific combination so that it adds up to "4" by adding the following specs: a+a+a+a+a+a+a+a = 0.5 per/unit = (In total it sum:) 4 b+b+b+b = 1 per/unit = (In total it sum:) 4 c+c = 2 per/unit = (In total it sum:) 4 That way I want to know ..

If a user enters a number "n" (integer) not equal to 0, my program should check if the the fraction 1/n has infinite or finite number of digits after the decimal sign. For example: for n=2 we have 1/2=0.5, therefore we have 1 digit after the decimal point. My first solution to this problem was ..

I wonder, why functional objects in c++ are implemented as templated, with void as default type since c++14. For example: https://en.cppreference.com/w/cpp/utility/functional/plus https://en.cppreference.com/w/cpp/utility/functional/minus This object in fact performs arithmetic operation +, -, *, /, when called by operator(). The operator() has to be template to work with different types as arguments, but why does the struct ..

## Recent Comments