|
-
Jul 3rd, 2001, 12:27 AM
#1
Thread Starter
Addicted Member
decimal to binary
humm...
trying to convert decimal to binary but I'm a bit stuck I've been trying to do the following, but I want to assign it back to a variable, any ideas?
void ConvertToBinary(float &line){
int gpow=-1;
int rem;
//find the largest power of 2
while( pow (2, ++gpow) <= line);
//divide by the power of two
while (gpow >= 0){
line = line / pow (2, --gpow);
cout << floor( line);
}
cout << endl;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|