+ 1
There are how many integer literals in c++?
4 Respostas
+ 17
Thanks a lot dear Martin. @~)~~~~
+ 15
Hi Mr.Taylor,
After a quick skimming the following link, I got the idea what they are. In fact, before that I had a gut level feeling about how we would represent them (based on your previous guidance in one of my projects).
[ http://en.cppreference.com/w/cpp/language/integer_literal]
BTW, recently, I've learned how to use bitset library facilities and have done a little project.
[https://code.sololearn.com/c9lLDE93zjar/?ref=app]
+ 13
#include <iostream>
using namespace std;
int main()
{
// Number 15 in different bases
int a = 15; // Dec
int b = 0x15; // Hex
int c = 015; // Oct
int d = 0b1111; // Bin
cout << a << " Dec" << endl;
cout << b << " Hex" << endl;
cout << c << " Oct" << endl;
cout << d << " (C++ doesn't have direct binary representation of integral types.)"<< endl;
}
[http://cpp.sh/6k4sl]
+ 4
There are 4:
Hexadecimal, Decimal, Octal and Binary