473,322 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

converting the floating point number to its equivalent

1
Hello, I'm a newbie at C and i have a problem:) I tried to solve this by using for. but i couldnt. the program should read a floating point number from the user character by character until the character ‘!’, and then convert it to its floating point equivalent. and the problem says "You must perform a simple input check. If the user enters a character other than a digit or point, warn the user and exit the program.":)
eg:
824.3211!
824.321100
please help me:)
Oct 19 '06 #1
2 2179
arne
315 Expert 100+
Hello, I'm a newbie at C and i have a problem:) I tried to solve this by using for. but i couldnt. the program should read a floating point number from the user character by character until the character ‘!’, and then convert it to its floating point equivalent. and the problem says "You must perform a simple input check. If the user enters a character other than a digit or point, warn the user and exit the program.":)
eg:
824.3211!
824.321100
please help me:)
What about posting your current code so we can use that as a starting point? I think that may be much better for you than if someone just sends his complete solution :-)
Oct 19 '06 #2
Banfa
9,065 Expert Mod 8TB
look up the function strtod(...)
Oct 19 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

31
by: JS | last post by:
We have the same floating point intensive C++ program that runs on Windows on Intel chip and on Sun Solaris on SPARC chips. The program reads the exactly the same input files on the two platforms....
25
by: TK | last post by:
I'm used to programming in c or c++ in which my problem is simple. I want to be able to enter a value on a page (like 3.2), and then read it as a 32-bit float and break it into it's individual...
7
by: Daniel Vallstrom | last post by:
I am having trouble with floating point addition because of the limited accuracy of floating types. Consider e.g. x0 += f(n) where x0 and f are of some floating type. Sometimes x0 is much larger...
2
by: Benjamin Rutt | last post by:
Does anyone have C code laying around to do this? I have to read in some binary data files that contains some 4-byte IBM/370 floating point values. I would like a function to convert 4-byte...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
13
by: Paraic Gallagher | last post by:
Hi, This is my first post to the list, I hope somebody can help me with this problem. Apologies if it has been posted before but I have been internet searching to no avail. What I am trying...
1
by: TC | last post by:
I am getting small math errors when I use a query to convert a column's data type from Text to Single. I am using a calculated column with the following expression. HighSchoolGPA:...
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
7
by: ma740988 | last post by:
Consider the equation (flight dynamics stuff): Yaw (Degrees) = Azimuth Angle(Radians) * 180 (Degrees) / 3.1415926535897932384626433832795 (Radians) There's a valid reason to use single...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.