LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-03-2003, 02:40 AM   #1
Xiangbuilder
Member
 
Registered: Apr 2003
Location: Shandong province China
Distribution: fedora core 1.0
Posts: 206

Rep: Reputation: 30
Could I directly output a binary number?


I can directly output the number formatting in decimal, octal, and hexadecimal by.
Code:
cout<<dec<<15<<endl
    <<oct<<15<<endl
    <<hex<<15<<endl;
However, I can't output the binary number by cout<<bin<<15<<endl;
Is there a method which I can directly output the binary number by just as I output the octal number above?
Thank you.

Last edited by Xiangbuilder; 10-03-2003 at 02:41 AM.
 
Old 10-03-2003, 07:14 AM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
you would have thought the setbase manipulator would do this, however from what i can tell it only works for bases 8, 10, and 16. so i guess youre gonna have to write your own.
 
Old 10-03-2003, 08:27 AM   #3
Xiangbuilder
Member
 
Registered: Apr 2003
Location: Shandong province China
Distribution: fedora core 1.0
Posts: 206

Original Poster
Rep: Reputation: 30
Thank you.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can we run the binary file directly kamesh156 Linux - General 1 10-17-2005 07:57 AM
output number of blank lines tjgadu Linux - Newbie 7 06-09-2005 04:01 PM
How to output a C stream into a binary file readable via Fortran I/O? zero79 Programming 8 02-07-2005 08:51 PM
micrphone output directly eduif Linux - Software 0 08-25-2004 11:22 AM
Limiting access to binary to x number of users? greenhornet Linux - General 2 07-31-2003 10:48 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration