Program character array to a signed floating point number, Programming Languages

Write a function that converts a character array to a signed floating point number. Function prototype must be as follows: int asciiToFloat( char *str, unsigned char* eflag) Follow similar conventions as in problem 10, but the decimal point, . is now a legal character.

YOU MAY NOT USE THE LIBRARY ATOI AND ATOF FUNCTIONS, but you may use any string library function.

The function must only have two parameters. str is the character string to be converted.

a) If the string has any leading non-numeric characters other than + or -, your function should print an error message, set eflag to 1, and return 0.

b) Any non-digit characters other than 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and . should also result in an appropriate error message, setting the eflag to 1 and returning 0.

c) Otherwise, your function should convert numeric ascii character string to the appropriate signed integer value. The eflag should be zero for a successful conversion. Return the signed integer value.

d) Examples of invalid strings:



e) Examples of valid strings:





For an entry such as -0, return 0.

f) Include comments to explaining how your function works.

Posted Date: 3/7/2013 12:36:17 AM | Location : United States

Related Discussions:- Program character array to a signed floating point number, Assignment Help, Ask Question on Program character array to a signed floating point number, Get Answer, Expert's Help, Program character array to a signed floating point number Discussions

Write discussion on Program character array to a signed floating point number
Your posts are moderated
Related Questions
Windows XP using C# load a binary file and send it thru a USB port to the USB port of STM32. STM32 received the file and then write it into an I2C EEPROM.

i(t)=(V/R) * (1-e^-(R/L)(t)) (a) Defi ne an anonymous function answerE that returns i(t) given input t. (b) The fi nal value for the current is 2 amps. Find a time tm when the curr

about how to create the program in c

Simple Shell In this LAB, you will explore and extend a simple Unix shell interpreter. In doing so, you will learn the basics of system calls for creating and managing process

Short Arrays: Array = randi(10,1,randi(6,1,1)+4)-5 This command will generate an array which you should be able to evaluate by hand (and also have your code evaluate for te

You must implement the control mechanism for the robot arm so that it can safely move the blocks from the source pile to their destination, without colliding with any obstacles or

Area Under Curve Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve be

What is DOM? The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure an

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

hello there, I making a program for the collage but I got stuck at one point, I have a timmer that moves object pnl with the pnl.left function, but I want it when it gets to end of