cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Can you use if statements in a switch st
Can you use if statements in a switch statement?
Mar 27, 2009 at 5:41pm UTC
kenneth196
(10)
I'm working on a project for my class, & I'm using a switch statement. But I need to use if statements in my switch also. Is it possible?
For instance,
switch(intVariableHere)
{
case 1:cout <<"blablabla" << endl;
if (blabla)
{
cout << "blabla" << endl;
}
break;
Mar 27, 2009 at 5:50pm UTC
eker676
(427)
Yes it is. (Nesting)
When in doubt, perform a test.
Last edited on
Mar 27, 2009 at 5:50pm UTC
Mar 27, 2009 at 6:41pm UTC
kenneth196
(10)
Oh ok. Thanks! I was just making sure since switch statement is another form of doing if statements, & I didn't want error messages from trying to mix the two.
Topic archived. No new replies allowed.