how can i convert string os size[10] to float. also i cannot use atof or sscanf. im asked to use bitwise or anyother methos which will take less processiong time.
is there anyway. thank you
shriagni
0
Newbie Poster
Recommended Answers
Jump to Postthere's a function in <cstdlib> called strtof (string to float) which can perfectly do that...
Jump to Postyou could convert one character at a time. start out by multiplying the result by 10 add the character and subtract '0', similar to how you would convert an integer
char inputstr[] = "123.45"; float result = 0.0F; // convert 1st character result = (result * 10) …
Jump to PostIf you can't use build-in standard C functions, then you need to figure out what I posted.
Any decimal digit in a string can be converted to its binary equlivalent by simply subtracting the ascii value of '0'. For example, '1' - '0' = 1. If you look up …
Jump to Postdear Ancient Dragon ,
You want to make Ancient Dragon happy?. Learn here how to properly tag the code you post.
i think this is code as u explained to me so i tried out the code not sure which to print out so printed out all the results.
…
All 15 Replies
ndeniche
402
Posting Virtuoso
Featured Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
shriagni
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
shriagni
0
Newbie Poster
Aia
1,977
Nearly a Posting Maven
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
ndeniche
402
Posting Virtuoso
Featured Poster
shriagni
0
Newbie Poster
ndeniche
402
Posting Virtuoso
Featured Poster
jefftanner
-1
Newbie Poster
jephthah
commented:
you resurrected a year-old thread for this crap? a massive IF statement? terrible.
-1
Prabakar
77
Posting Whiz
mitrmkar
1,056
Posting Virtuoso
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Prabakar
77
Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.