|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Help in for loop in C programming Hello, my problem is summarized in this loop: Code: Dim nbbills as Integer nbbills = 4 Dim nblines_f1 As Integer nblines_f1 = 13 Dim nblines_f2 As Integer nblines_f2 = 20 Dim nblines_f3 As Integer nblines_f3 = 8 Dim nblines_f4 As Integer nblines_f4 = 12 for i = 1 to nbbills 'Id like to see in the loop the value of nblines_fi for each turn' next |
#2
| |||
| |||
Re: Help in for loop in C programming I think you need a class Bill, which includes at least one property NumberLines, then a list of bills that you can browse in your loop. This should give something like this: Code: List <Bill> bills = new List <Bill> (); // Add 1 bill Bill bill = new Bill (); bill. NumberLines = 13; bills. Add (bill); // Add 2 bill bill = new Bill (); bill. NumberLines = 20; bills. Add (bill); // Redo for bill 3 and 4. // Display the list for (int i = 0; i <bills.Count; i++) { Console.WriteLine ("The bill {0} contains {1} line(s).", i. ToString (), bill (i).NumberLines.ToString ()) ; } |
#3
| |||
| |||
Re: Help in for loop in C programming You can do something like: Code: Dim nbbills As Integer = 4 Dim nblines_f1 As Integer = 13 Dim nblines_f2 As Integer = 20 Dim nblines_f3 As Integer = 8 Dim nblines_f4 As Integer = 12 Dim list As Integer () = {nblines_f1 ,nblines_f2, nblines_f3, nblines_f4} for i = 0 to list.Length -1 'View list (0) next
__________________ The FIFA Manager 2009 PC Game |
#4
| |||
| |||
Re: Help in for loop in C programming Quote:
|
![]() |
|
Tags: c programming, for loop |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Watercooling: Single loop or Dual Loop | Akolekar | Hardware Peripherals | 3 | 21-10-2011 10:52 PM |
Reboot Loop in Windows 7 Reboot loop and Safe mode doesn't work | mADiRAkSHii | Operating Systems | 4 | 25-01-2011 07:23 PM |
Socket programming: Is any new Programming Language? | Kushan | Software Development | 3 | 14-11-2009 11:13 AM |
do...while loop in C programming | Projectkmo | Software Development | 1 | 07-05-2009 09:52 PM |
JetBrains Introduces a New Programming Paradigm With its Meta Programming System | JoeFrat | Software Development | 3 | 13-12-2008 01:49 PM |