int x=011;
cout<<x;

it print 9. why?

Recommended Answers

All 9 Replies

it is a number in octal form as it has 0 in the starting. So it is 000 000 000 000 001 001, so this is nine as you well know ;) thanks

nitin1 is correct.

With a little more detail:

Any number that starts with a zero is interpreted in base 8 (octal) rather than base 10 (decimal). Therefore your 011 is: one 8 and one 1 rather than one 10 and one 1.

if i give input like 08 what will happen????

commented: walt will always be walt ;) he can never change :-D +2

@all..one of the foolish question i have ever asked. as soon as i posted it i realized the answer.
@admin..why there is no option to delete a post?

Because if you deleted the post, wouldn't all the replies look a little stupid? ;-)

when there are no comments even then i cant delete it?

when there are no comments even then i cant delete it?

No. You can report it with the "Flag Bad Post" link and a reason stating why you want it deleted. Then a moderator will determine if the reason is...well, reasonable. But posts are typically only deleted based on serious rule violations such as illegal content, being complete spam, or copyright violation. We generally don't honor frivolous requests, but that doesn't mean you're not welcome to make them anyway on the off chance that it will be honored.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.