Thread: Ok I'm stuck with a double to float error

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    68

    Ok I'm stuck with a double to float error

    Here's the snippet of code that I'm having problems with:

    Code:
                   
    
                    int            customernumber;
    	float	waterlevel;
    	float	previouslevel;
    	float	totalwater;
    	float	totalbill;
    	float	amountowed;
    
    
    	printf("Enter customer number\n" );
    
    	scanf( "%d" ,  &customernumber );
    
    	printf("Enter current water level\n" );
    
    	scanf("%f" , &waterlevel );
    
    	printf("Enter previous water level\n" );
    
    	scanf("%f", &previouslevel );
    
    	totalwater = waterlevel - previouslevel;
    
    	totalbill = 30 + (totalwater/1000  * .55);
    
    	amountowed = totalbill;
    I keep getting this warning "conversion from double to float, possible loss of data" for this line

    totalbill = 30 + (totalwater/1000 * .55);

    I dont understand what it could mean, everything is declared as float ( I, obviously, made sure of that), if anyone has any idea what's wrong with this line I would really appreciate it if ya could share it with me.
    Thank you very much.
    Last edited by Extropian; 06-06-2005 at 11:24 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. file reading
    By gunghomiller in forum C++ Programming
    Replies: 9
    Last Post: 08-07-2007, 10:55 PM
  4. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM