|
-
Jan 15th, 2003, 05:13 PM
#1
Thread Starter
Frenzied Member
Using ||
How would I write that to make it work?
while (choice !=(0)||(1)||(2)||(3)) {cout<< "Try again "; cin>> choice;}
-
Jan 15th, 2003, 05:22 PM
#2
Frenzied Member
((choice!=0) && (choice!=1)&&(choice!=2)&&(choice!=3))
Z.
-
Jan 15th, 2003, 05:31 PM
#3
transcendental analytic
why not
choice>3||choice<0
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jan 15th, 2003, 05:48 PM
#4
Thread Starter
Frenzied Member
Do I have to rewrite choice every time? Is there any way around doing that?
And I didn't want to use the < > becuase that does not work for characters.
-
Jan 15th, 2003, 05:53 PM
#5
Frenzied Member
Originally posted by aewarnick
Do I have to rewrite choice every time? Is there any way around doing that?
And I didn't want to use the < > becuase that does not work for characters.
You have to rewrite choice each time.
And < > both work with characters.
Z.
-
Jan 15th, 2003, 06:11 PM
#6
Thread Starter
Frenzied Member
Do you mean that C++ follows the alphabet?
-
Jan 15th, 2003, 06:18 PM
#7
Frenzied Member
Originally posted by aewarnick
Do you mean that C++ follows the alphabet?
C++ knows that 'A' comes before 'B', if that is what you are asking.
Z.
-
Jan 15th, 2003, 06:21 PM
#8
But 'a' comes after 'Z', so it doesn't work every time.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 15th, 2003, 06:30 PM
#9
Thread Starter
Frenzied Member
-
Jan 15th, 2003, 07:15 PM
#10
Frenzied Member
Originally posted by CornedBee
But 'a' comes after 'Z', so it doesn't work every time.
But of course... 'Z' is a much better letter 
Z.
-
Jan 16th, 2003, 04:55 AM
#11
transcendental analytic
assuming choice is an alpha you could flag off the lower case bit
choice&0xdf<'C'
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jan 16th, 2003, 07:36 AM
#12
Guru
Originally posted by kedaman
assuming choice is an alpha you could flag off the lower case bit
choice&0xdf<'C'
Hehe, sure.. You can also do choice &= 3; in the original question and then not worry about an invalid choice
-
Jan 16th, 2003, 05:31 PM
#13
transcendental analytic
hehe how about this for the test 
choice&0xFFFFFFFC
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|