| | |
Enquiries on printf function
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
http://www.cplusplus.com/reference/c...cstdio/printf/
This is a complete explaination of the printf function . you will notice that %x or %X is denoted to show the hexadecimal notation.
Though I am unsure about being able to print out the binary value.
This is a complete explaination of the printf function . you will notice that %x or %X is denoted to show the hexadecimal notation.
Though I am unsure about being able to print out the binary value.
•
•
•
•
but what if I want the hexadecimal 199 to be displayed in binary?
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <limits> #include <bitset> int main() { std::cout << std::bitset<std::numeric_limits<int>::digits>(0x199) << '\n'; }
Last edited by Tom Gunn; Sep 8th, 2009 at 9:44 am.
-Tommy (For Great Justice!) Gunn
•
•
Join Date: Aug 2009
Posts: 39
Reputation:
Solved Threads: 0
I am a bit unclear about this line
std::cout << std::bitset<std::numeric_limits<int>::digits>(0x199) << '\n';
I know that because your do not use the namespace std hence your use std:: to replace it.
But if I am to write in this format:
#include <iostream>
#include <limits>
#include <bitset>
using namespace std; /*<--the thing that i mentioned*/
int main()
{
cout << bitset<numeric_limits<int>::digits>(0x199) << '\n';
}
am i correct?
std::cout << std::bitset<std::numeric_limits<int>::digits>(0x199) << '\n';
I know that because your do not use the namespace std hence your use std:: to replace it.
But if I am to write in this format:
#include <iostream>
#include <limits>
#include <bitset>
using namespace std; /*<--the thing that i mentioned*/
int main()
{
cout << bitset<numeric_limits<int>::digits>(0x199) << '\n';
}
am i correct?
Enquiries about printf function is more of a c question don't you think?
1) What word becomes shorter if you add a letter to it?
[ Solved by : niek_e, Paul Thompson, SgtMe, murtan, xavier666, jonsca]
2) What does this sequence equal to : (.5u - .5a)(.5u-.5b)(.5u-.5c) ...
[*solved by : murtan, xavier666]
3) What is the 123456789th prime numer?![]() |
Similar Threads
- wrong # of args in function call printf (C)
- evaluation of expressions in printf() function (C)
- concatenate function (C)
- passing data from one function to another in C (C)
- printf & cout (C)
- Printf in C++ (C++)
- printf buffer strange behaviur (C)
Other Threads in the C++ Forum
- Previous Thread: 1540-0063 (S) The text "eventqueue_t" is unexpected.
- Next Thread: c++ OOP Mortgage Calculator
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count database delete deploy developer dll download dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph gui homeworkhelp iamthwee ifstream image input int java lib library linker list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






