Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/24/04 16:22
Read: times


 
#81861 - WYGIWYAF
Responding to: ???'s previous message
Farhan Arshad said:
The calculator which i had make shows 9.801E+07. which is the right answer but i want to convert this result into 98010000. My answer is in a double data type

Donald Catto said:
sprintf()

Farhan Arshad said:
I have already used sprint(). sprintf converts the value of double (in which i have the result) into the char buffer. But my problem is how can i convert 9.801E+07 into 98010000.

No, that isn't your problem.

Your problem is, surely, that you have used the wrong format specification in your sprintf call?
If you don't want scientific notation, then don't use that format spec - use the one you actually want!
See your compiler manual - or any good 'C' textbook.

WYGIWYAF = What You Get Is What You Asked For!

List of 18 messages in thread
TopicAuthorDate
Scientific notation to normal notation            01/01/70 00:00      
   "            01/01/70 00:00      
      Notation            01/01/70 00:00      
         is this float to long?            01/01/70 00:00      
            Format            01/01/70 00:00      
               Ooops            01/01/70 00:00      
               sprintf            01/01/70 00:00      
                  Time for clarification            01/01/70 00:00      
                     "            01/01/70 00:00      
                        Sprintf            01/01/70 00:00      
                           "            01/01/70 00:00      
         "            01/01/70 00:00      
         WYGIWYAF            01/01/70 00:00      
   Hi            01/01/70 00:00      
      notation problem            01/01/70 00:00      
         try sprintf(buffer,"%f",result);            01/01/70 00:00      
            New habits            01/01/70 00:00      
         Exactly what it says on the tin!            01/01/70 00:00      

Back to Subject List