473,396 Members | 1,843 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,396 software developers and data experts.

Loop Question

I need a loop that can be put in 3 instances. I am not sure which loop I can find and I dont want to use a switch statement so can you help? I Already know the code just the loop for it.
Basically I want to

if (blabla)
{ then do this};
if (blabla2)
{ then do this};
if (blabla3)
{then do this};
Apr 6 '07 #1
11 1648
Can someone give me an answer please?
Apr 6 '07 #2
jj555s
36
I'm not sure what you're trying to do...
Apr 6 '07 #3
ilikepython
844 Expert 512MB
I need a loop that can be put in 3 instances. I am not sure which loop I can find and I dont want to use a switch statement so can you help? I Already know the code just the loop for it.
Basically I want to

if (blabla)
{ then do this};
if (blabla2)
{ then do this};
if (blabla3)
{then do this};
What do you mean by a loop? Do you want to continue looping through the if statements until something happens? If not then what are you trying to do?
Apr 6 '07 #4
jj555s
36
I'm guessing since you don't want a case switch
that you're looking for if, else?
Apr 6 '07 #5
hey ..how to print all possible combinations of a,b,c.plz help
Apr 6 '07 #6
I need a loop that can be put in 3 instances. I am not sure which loop I can find and I dont want to use a switch statement so can you help? I Already know the code just the loop for it.
Basically I want to

if (blabla)
{ then do this};
if (blabla2)
{ then do this};
if (blabla3)
{then do this};
Seems to me that if loops aren't a good way to go. You should use a case or switch statement for this kind of work, because loops are better for repition on a current condition.
Apr 6 '07 #7
Azka
3
what the action you want?

i think loop can be done by combine using "loop for" and if..

this can be solved when we know what you want to display
Apr 6 '07 #8
Azka
3
what kind you want to display? char or int..

this command to display the int..
printf("%d %d %d",a,b,c);
Apr 6 '07 #9
U cn use a nested while loop.
Apr 15 '07 #10
JosAH
11,448 Expert 8TB
hey ..how to print all possible combinations of a,b,c.plz help
Have a look at this little table and see if you can use it:
Expand|Select|Wrap|Line Numbers
  1. A B C
  2. -----
  3. 0 0 0 -
  4. 0 0 1 C
  5. 0 1 0 B
  6. 0 1 1 BC
  7. 1 0 0 A
  8. 1 0 1 AC
  9. 1 1 0 AB
  10. 1 1 1 ABC
kind regards,

Jos
Apr 15 '07 #11
I need a loop that can be put in 3 instances. I am not sure which loop I can find and I dont want to use a switch statement so can you help? I Already know the code just the loop for it.
Basically I want to

if (blabla)
{ then do this};
if (blabla2)
{ then do this};
if (blabla3)
{then do this};
try to use the if=else if loops
Apr 15 '07 #12

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

Similar topics

33
by: Arthur | last post by:
>>>a= >>> for p in a: print p 1 2 3 >>> p 3 My naive expectation was that p would be 'not defined' from outside
0
by: John Wilson | last post by:
Hello, I have the following code which populates as table data from a SQL Server 2000 stored proc (RSByDemoID2). Below that is the view and stored procedure which takes @DemoID as input to match...
3
by: zeroDoNotYeSpamtype | last post by:
(I tried to post this earlier, but it seems without success) A similar question to this has been answered many times, to whit the question applying when the index variable of a for loop is...
3
by: Gustavo Randich | last post by:
The following seems to be a bug. The execution returns rows 1,2. It should return 1,1. In fact, if I run the code within a stored procedure alone (not in a trigger), the loop doesn't overwrite the...
22
by: Jan Richter | last post by:
Hi there, the Code below shows DJBs own implementation of strlen (str_len): unsigned int str_len(char *s) { register char *t; t = s; for (;;) { if (!*t) return t - s; ++t;
8
by: Shamrokk | last post by:
My application has a loop that needs to run every 2 seconds or so. To acomplish this I used... "Thread.Sleep(2000);" When I run the program it runs fine. Once I press the button that starts the...
29
by: garyusenet | last post by:
I'm trying to investigate the maximum size of different variable types. I'm using INT as my starting variable for exploration. I know that the maximum number that the int variable can take is:...
3
by: nina297 | last post by:
Good morning, How do I set up a For each loop to loop through my records in the database? My fields are topics, question and answers. I want the one topic displayed that goes with each...
44
by: James Watt | last post by:
can anyone tell me how to do an infinite loop in C/C++, please ? this is not a homework question .
2
by: perkykoala | last post by:
I apologize in advance for being REALLY detailed/verbose. It's the result of staring/tweaking code for too long. Using VB 2005: I need to design a multiple choice test (unfortunately, I can't...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.