Hey guys
Am working on this program, a part of which requires the input fixed-point binary number to be converted to decimal for example;
11001.101 to its equivalent mixed decimal number...........any suggestions(a function would be excellent :) )?
nishantsharma 0
Newbie Poster
Recommended Answers
Jump to PostSplit the problem into parts. If it were me, Id first make a function to convert a binary string to an integer, and then a second function to turn the fixed-point binary string into a double type.
#include <iostream> int bin_to_int(char *binary) { // ... } double …
Jump to Post#include <iostream> int bin_to_int(char *binary) { // ... } double bin_to_double(char *binary_fixed_point) { // ... } int main() { // ... }
Hope this helps.
You forgot to put the
using namespace std;
instruction in your snippet :P
All 7 Replies
William Hemsworth 1,339
Posting Virtuoso
Salem
commented:
Good advice +30
mvmalderen 2,072
Postaholic
ShawnCplus 456
Code Monkey Team Colleague
mvmalderen 2,072
Postaholic
ShawnCplus 456
Code Monkey Team Colleague
NathanOliver 429
Veteran Poster Featured Poster
mvmalderen 2,072
Postaholic
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.