converting double to long int
I'm trying to convert a double to a long int, but i keep getting a warning message saying :
34 C:\Dev-Cpp\PROG1B.cpp [Warning] converting to `long int' from `double'
How do i ignore the warning so i can compile it?
Here's how i started setting up the code:
Code:
#include <iostream>
#include <math.h>
#include <cmath>
using namespace std;
int main()
{
//Declaring Variables
double tendered;
double purchase;
double chg;
long change;
int fives;
int ones;
int half;
int quarters;
int dimes;
int nickels;
int pennies;
cout << "Enter purchase amount: ";
cin >> purchase;
cout << "Enter tendered amount: ";
cin >> tendered;
//Calculating change amount
chg = tendered - purchase;
//Converting double to long
change = ceil(chg * 100);
//Display error message if change is more than 19.99
If (chg > 19.99)
cout << "Amount to return is: " << chg << "--Sorry just dont have that amount of change";
getch();
return 0;
fives = change / 5;
ones = (change - 5) / 1;
cout << "Fives" << fives;
return 0;
}