Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: octal error
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 26 Topic 45831 of 48044
Post > Topic >>

Re: octal error

by "Victor Bazarov" <v.Abazarov@[EMAIL PROTECTED] > May 9, 2008 at 05:22 PM

notahipee wrote:
> I have been trying to cin an number from 0 to 9 with a leading 0. For
> example 00 or 07. I was using a switch case.

You were using a switch case for what?

> switch (int)
  ^^^^^^^^^^^
That's a syntactically incorrect statement.

> {
> case 01: break;
> case 02: break;.....
> My problem arises at 08 and 09 because they are not octal.

What problem would that be?

> Is there
> any way to coerce the input variable to decimal despite it having a
> leading zero .

This is a glimmer of an actual problem you seem to be having... But
I am not seeing the alleged behaviour in the following program.

#include <iostream>
#include <ostream>
int main()
{
    int a = 666;
    std::cin >> a;
    std::cout << "you entered " << a << std::endl;
}

If I enter 08, it prints 'you entered 8'.  What's the problem?

V
-- 
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
 




 26 Posts in Topic:
octal error
notahipee <werldpeace@  2008-05-09 14:14:28 
Re: octal error
"Victor Bazarov"  2008-05-09 17:22:52 
Re: octal error
notahipee <werldpeace@  2008-05-09 14:36:12 
Re: octal error
"Victor Bazarov"  2008-05-09 17:53:19 
Re: octal error
"kwikius" <a  2008-05-09 22:54:06 
Re: octal error
"Default User"   2008-05-09 22:01:34 
Re: octal error
"kwikius" <a  2008-05-09 23:10:49 
Re: octal error
Juha Nieminen <nospam@  2008-05-10 09:30:42 
Re: octal error
"Default User"   2008-05-09 21:48:37 
Re: octal error
notahipee <werldpeace@  2008-05-09 14:53:58 
Re: octal error
"Victor Bazarov"  2008-05-09 17:59:38 
Re: octal error
=?UTF-8?B?RXJpayBXaWtzdHL  2008-05-10 14:39:05 
Re: octal error
notahipee <werldpeace@  2008-05-09 15:12:46 
Re: octal error
"kwikius" <a  2008-05-09 23:36:35 
Re: octal error
"Default User"   2008-05-09 22:54:42 
Dates (was Re: octal error)
Andy Champ <no.way@[EM  2008-05-10 18:20:31 
Re: octal error
notahipee <werldpeace@  2008-05-09 15:17:34 
Re: octal error
notahipee <werldpeace@  2008-05-09 15:18:46 
Re: octal error
notahipee <werldpeace@  2008-05-09 16:18:08 
Re: octal error
James Kanze <james.kan  2008-05-10 08:14:54 
Re: Dates (was Re: octal error)
James Kanze <james.kan  2008-05-11 08:37:57 
Re: Dates (was Re: octal error)
Andy Champ <no.way@[EM  2008-05-11 21:26:28 
Re: Dates (was Re: octal error)
James Kanze <james.kan  2008-05-11 16:41:24 
Re: Dates (was Re: octal error)
Andy Champ <no.way@[EM  2008-05-12 23:08:03 
Re: octal error
Nick Keighley <nick_ke  2008-05-12 06:47:48 
Re: Dates (was Re: octal error)
James Kanze <james.kan  2008-05-13 02:06:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Oct 15 22:46:30 CDT 2008.