![]() |
|
#1
|
|||
|
|||
conversion double to floatwarning C4244: '=' : conversion from 'double' to 'float', possible loss of data
e:\ap power\project4.cpp(261) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data e:\ap power\project4.cpp(270) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data e:\ap power\project4.cpp(280) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data e:\ap power\project4.cpp(28 e:\ap power\project4.cpp(29 e:\ap power\project4.cpp(304) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data I need help badly. I can compile my program but is warning have stop me from get the program to run well. Can someone guide me along and what possible error do i have. thanks |
|
#2
|
||||
|
||||
Re: conversion double to floatHello and Welcome to GIDForums™ donaldk. Please read the Sticky that gives some good guidelines for posting. Without any code, it is not likely you will get much help.
Mark __________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work." --Thomas Alva Edison "Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety." --Benjamin Franklin "A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes." --Hugh Downs |
|
#3
|
|||
|
|||
Re: conversion double to floatQuote:
These are warnings, not errors. Look at the lines that were flagged. Was there some assignment to a variable of type float? Was there a function call where a parameter was of type float? What? Since "doubles" have more precision than "floats", assignment of an expression that has type "double" to a variable or function parameter that has type "float" will give this message with (some) C++ compilers. Note that floating point literals, such as 3.3 are treated by compilers as "doubles". If you want to make sure the compiler treates it as a "float", then use 3.3f in expressions. No one can here tell you whether the items flagged by these messages cause your program not to "run well", since no one here has seen your code. In fact, we don't have any way of knowing what you mean by not running well. What exactly happens when you attempt to run your program? You might get rid of the messages by changing your variables from "floats" to "doubles" (if the program specification allows that). If you have variables, x and y of type "float", and you have something like x = y / 3.0;, you could either change the declarations of x and y to make them "doubles" or you could change the assgnment statement to x = y / 3.0f. Regards, Dave |
|
#4
|
|||
|
|||
Analysis the function for chargesHi, thanks for the guiding and help. However, i need to help to analysis the program of the car parking. This program allow user to key in "Entry point X to the car park and Exit point A or Exit point B from the car park.It also allow user the key in the entry time and exit time.
It is the charges of the park slots that confuse me. I need help in analysis the last past of the function. void amount(struct transaction inf[],int h) For peak hours, 7am to 5.59pm, the parking charge for the car parking is $1.00 per half-hour. For non-peak hours, 6pm to 6.59am, the parking charge is $0.50 per half-hour. The parking is always calculated to the nearest half-hour Below is the program. CPP / C++ / C Code:
Last edited by LuciWiz : 27-Mar-2006 at 12:29.
Reason: Please insert your C code between [c] & [/c] tags
|
|
#5
|
|||
|
|||
Re: Analysis the function for chargesQuote:
Let's see; by my rough approximation, there are about 668 lines of code and about 416 are highlighted in red. I think there is a typographical error on line 566: CPP / C++ / C Code:
Probably should be 23.59, not 23,59 Regards, Dave Last edited by davekw7x : 12-Feb-2006 at 23:19.
|
|
#6
|
|||
|
|||
Re: Analysis the function for chargesQuote:
__________________
Please read http://www.gidforums.com/t-5566.html. They were written to help you create a request that is readable and has enough information we can actually tell what you need help with. |
Recent GIDBlog
Developing GUIs with wxPython (Part 2) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Canny edge detector | Skm | Java Forum | 1 | 01-Jan-2006 06:51 |
| Powell Method | EngineerFORhire | C Programming Language | 5 | 01-Oct-2005 00:34 |
| Double output | leanieleanz | C++ Forum | 1 | 11-Mar-2005 20:19 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The