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 25 of 26 Topic 45831 of 48020
Post > Topic >>

Re: octal error

by Nick Keighley <nick_keighley_nospam@[EMAIL PROTECTED] > May 12, 2008 at 06:47 AM

notahipee wrote:

> This is all of it.

no it isn't

> #include <iostream>
> #include <ostream>
> int main()
> {
>   int a;
>
>      cout << "enter a number " << endl;
>      cin >> a;
>  switch (a)
> {
> case 00: cout << zero;
> case 01: cout << zero one;
> case 02: cout << zero two;
> case 03: cout << zero three;
> case 04: cout << zero four;
> case 05: cout << zero five;
> case 06: cout << zero six;
> case 07: cout << zero seven;
> case 08: cout << zero eight;
> case 09: cout << zero ninne;
> }
>
> return 0;
> }

my compiler gives

C:\bin\nota.cpp(8) : error C2065: 'cout' : undeclared identifier
C:\bin\nota.cpp(8) : error C2297: '<<' : bad right operand
C:\bin\nota.cpp(8) : error C2065: 'endl' : undeclared identifier
C:\bin\nota.cpp(9) : error C2065: 'cin' : undeclared identifier
C:\bin\nota.cpp(13) : error C2065: 'zero' : undeclared identifier
C:\bin\nota.cpp(14) : error C2146: syntax error : missing ';' before
identifier 'one'
C:\bin\nota.cpp(14) : error C2065: 'one' : undeclared identifier
C:\bin\nota.cpp(15) : error C2146: syntax error : missing ';' before
identifier 'two'
C:\bin\nota.cpp(15) : error C2065: 'two' : undeclared identifier
C:\bin\nota.cpp(16) : error C2146: syntax error : missing ';' before
identifier 'three'
C:\bin\nota.cpp(16) : error C2065: 'three' : undeclared identifier
C:\bin\nota.cpp(17) : error C2146: syntax error : missing ';' before
identifier 'four'
C:\bin\nota.cpp(17) : error C2065: 'four' : undeclared identifier
C:\bin\nota.cpp(18) : error C2146: syntax error : missing ';' before
identifier 'five'
C:\bin\nota.cpp(18) : error C2065: 'five' : undeclared identifier
C:\bin\nota.cpp(19) : error C2146: syntax error : missing ';' before
identifier 'six'
C:\bin\nota.cpp(19) : error C2065: 'six' : undeclared identifier
C:\bin\nota.cpp(20) : error C2146: syntax error : missing ';' before
identifier 'seven'
C:\bin\nota.cpp(20) : error C2065: 'seven' : undeclared identifier
C:\bin\nota.cpp(21) : error C2041: illegal digit '8' for base '8'
C:\bin\nota.cpp(21) : error C2146: syntax error : missing ';' before
identifier 'eight'
C:\bin\nota.cpp(21) : error C2065: 'eight' : undeclared identifier
C:\bin\nota.cpp(22) : error C2041: illegal digit '9' for base '8'
C:\bin\nota.cpp(22) : error C2146: syntax error : missing ';' before
identifier 'ninne'
C:\bin\nota.cpp(22) : error C2065: 'ninne' : undeclared identifier

you also misssed all the breaks out of your switch statement.

I can't see what "zero one" is supposed to mean in

   case 01: cout << zero one;

wouldn't

   case 01: cout << "zero one";

make more sense?

--
Nick Keighley
 




 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 Tue Oct 14 9:00:10 CDT 2008.