473,385 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

nesting switch?

kaleeswaran
132 100+
hi
can we use switch inside another switch statement...?
i am doing banking program.i tried to call another switch statement with in switch statement but it show error.
clarify my doupt plzzzzzzzzzz
Apr 12 '07 #1
3 1492
JosAH
11,448 Expert 8TB
hi
can we use switch inside another switch statement...?
i am doing banking program.i tried to call another switch statement with in switch statement but it show error.
Yes you can do that; a switch statement is just another statement which can
occur where all other statements could've been located.

I advise you not to do that unless you like jumpy, unreadable wall paper code.
Better create another method that takes care of the inner switch.

kind regards,

Jos
Apr 12 '07 #2
I think it kinda looks funny, switched switches, but indeed i would not use them. Perhaps make a method that does the smaller switches. Here is the correct syntax:

Expand|Select|Wrap|Line Numbers
  1. switch(state) {
  2.   case 0: switch(state2) {
  3.                 case 0: state = 2;
  4.                 case 1: state =12343854686434;
  5.                 };
  6.   case 1: etc etc;
  7. }
  8.  
BSCode266
Apr 12 '07 #3
kaleeswaran
132 100+
fine thank you,
Apr 12 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Philip WATTS | last post by:
I am trying to carry out multiple checks on some input data. I am doing this by the running the data through a number of functions. i.e. I have an onclick that calls a function, which in turn calls...
0
by: Wolfgang Schwanke | last post by:
Dear usenet, I'm having the following small problem. I've been ask to add some Quicktime panoramas to a website. The author of the panoramas has made two versions of each: One in MOV format,...
8
by: Harlan Messinger | last post by:
I just read the note under the XHTML spec (http://www.w3.org/TR/xhtml1/#h-4.9) that explains how XML DTD notation doesn't provided for the exclusion of elements from containment by the element...
8
by: Hardrock | last post by:
I encountered some difficulty in implementing dynamic loop nesting. I.e. the number of nesting in a for(...) loop is determined at run time. For example void f(int n) { For(i=0; i<=K; i++)...
22
by: Technoid | last post by:
Is it possible to have a conditional if structure nested inside a conditional switch structure? switch(freq) { case 1: CASENAME if (variable==1) { do some code }
4
by: kl.vanw | last post by:
I would like to count the nesting level in template classes. How can I make the following work? #include <assert.h> template <class T> class A { public: A() { // what goes here?
6
by: stephen.cunliffe | last post by:
Hi, I'm looking for opinion/facts/arguments on the correct nesting of UL, OL, & LI elements. For example, this is what I want (unordered list): * Item 1 * Item 2 * Item 3
11
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
Can switch statements be nested? I've got a large routine that runs off of a switch statement. If one of the switches in switch #1 is true, that enters switch statement #2. Some of the...
17
by: henry | last post by:
Folks Here's a skeleton, generic HTML page, call it "index.php". You'll see a bit of php code in the middle: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.