Define following constant | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Define following constant

26,031,0 X BC4,0 X 2A

28th Sep 2018, 5:22 AM
Curious Mind
Curious Mind - avatar
2 Answers
+ 2
To define a constant use the following syntax: const <type> <name> {<value>}; Where: <type> defines the type of the constant value. <name> identifier for the constant. <value> the value or expression to be assigned as constant value. Example (in main): const int A {26}; // <- decimal const int B {031}; // <- octal const int C {0xbc4}; // <- hexadecimal const int D {0x2a}; // <- hexadecimal cout << A << endl << B << endl << C << endl << D; NOTE: Don't put spaces inside a hexadecimal number, just the base identifier 0x followed with the value, e.g. 0x12345. Hth, cmiiw
28th Sep 2018, 7:05 AM
Ipang
0
What do you want to do? Please explain with as many detail as you can
28th Sep 2018, 5:33 AM
Daniele Bonomi
Daniele Bonomi - avatar