|
|
|||||||
| About Us | Register | FAQ | Members List | Calendar | Mark Forums Read |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Registered User
![]() ![]() Join Date: Apr 2001
Location: MX
Posts: 125
|
I have a little question, is there a way to represent an integer but using just 0 & 1, i mean in it's binary form?
Like the Java method: Code:
Integer.toBinaryString(int i) eg: Code:
int i =8; stdOut.println(Integer.toBinaryString(int i)); Code:
1000 thanks
__________________
Dell Inspiron 8000: 1Ghz P!!!, 512 MB SDRAM, GeForce4 Go w/64Mb DDR, UXGA 15" screen 1600x1200, ESS Maestro sound, 40GB HD, DVD-ROM 8x Pete's Plugins. WinXP Pro
|
|
|
|
|
|
#3 (permalink) |
|
A BIG BAD BATARD™
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2001
Posts: 5,517
|
fast and easy use std..
i.e Code:
using namespace std; ... blah blah code here ... int value = 8; bitset bs(value); string str = bs.to_string(); cout << str << endl; .... blah blah code here ... otherwise you can create your own routine like Ninja said, or _itoa when you are using msvc. Last edited by Xeven; October 10th, 2002 at 01:58. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|