Exemplo n.º 1
0
int main()
try {
    auto denoms = read_denominations();
    sort(denoms, greater<double>{});
    auto amount = read_amount();
    auto change = make_change(denoms, amount);
    print_change(denoms, change);
}
catch (runtime_error& e) {
    cerr << "runtime error: " << e.what() << '\n';
    return 1;
}
Exemplo n.º 2
0
int main()
{
	try {
		// read N - amount of numbers to calculate sum of
		int amount = read_amount();
		// read set of numbers
		vector<double> numbers = read_numbers();
		// output sum
		output_sum(calc_sum(numbers, amount), amount);
		// output diff numbers
		output_diff_vector(calc_diff_vector(numbers));
		
	} catch (exception& e) {
		cerr << e.what();
		return 1;
	} catch (...) {
		cerr << "Unknown error";
		return 2;
	}
}