Rounding Numbers

I am writing a program that asks for "annual income" is there a way to get the program to round the tax due amount up or down to the next number or should I ask for the "annual income" to be only whole numbers? This is what I have so far.
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;


int main( )
{
double income, tax, total;
cout << fixed << setprecision (2);
cout << "Please enter your annual income for 2012: " << endl;
cin >> income;



if( income < 0 )
{
cout << "Invalid Entry Please try Again " << endl;
system ("pause");
return 0;
}

if( income > 50000.00)
tax = (0.07 * income) + 2500.00;

else
if( income > 100000.00)
tax = (0.09 * income) + 6000.00;

else
if( income < 50000.00)
tax = 0.05 * income;

cout << "Tax due on your income is $" << tax
<< endl;






system ("pause");
return 0;
}


1
2
3
4
#include <cmath>

std::ceil(double) //round up
std::floor(double) //round down 
Topic archived. No new replies allowed.