There are how many integer literals in c++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

There are how many integer literals in c++?

12th Oct 2017, 9:18 AM
Kinjal
Kinjal - avatar
4 Answers
+ 17
Thanks a lot dear Martin. @~)~~~~
13th Oct 2017, 5:26 PM
Babak
Babak - avatar
+ 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]
12th Oct 2017, 8:02 PM
Babak
Babak - avatar
+ 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]
12th Oct 2017, 9:40 AM
Babak
Babak - avatar
+ 4
There are 4: Hexadecimal, Decimal, Octal and Binary
12th Oct 2017, 9:25 AM
Dapper Mink
Dapper Mink - avatar