This is a file named InBoundData.txt

1 B777 850 Paris KL 9395 11.40 am 6 2100
2 B747 900 Lon KL 10000 12.30 pm 7 2100
3 A380 900 LA KL 16800 10.30 am 15 2750
4 A340 850 CapeTOWN kL 9580 12.10 pm 6 3000
5 A330 800 Seoul KL 4600 10.30 am -1 2300
6 A330 800 HongKong PEN 2800 2.00 pm 0 800

How to make all this information into array file? izit possible to just declare inbounddata(which is the array) to be like inbounddata[6][9]? Will it read from the file?
Can i take the number this way?

cinfo<<"Option for inbound: "<<option<<endl;
     cinfo<<"Departure City: "<<inbounddata[option][4]<<endl;

Does the file have to look like that?
Can all that information be separated into lines like this:

B777
850
Paris
KL9395
11.40
am
6
2100

if so you can just use a simple for loop to get that data and put it in an array.

0 Type Speed Source Destination Distan Time apm Diff Price
1 B777 850 Paris KL 9395 11.40 am 6 2100
2 B747 900 London KL 10000 12.30 pm 7 2100
3 A380 900 LA KL 16800 10.30 am 15 2750
4 A340 850 CapeTOWN kL 9580 12.10 pm 6 3000
5 A330 800 Seoul KL 4600 10.30 am -1 2300
6 A330 800 HongKong PEN 2800 2.00 pm 0 800

Its shud let the user input the option according to number on the left and do sum calculation work according to that. such as i need to use the Distance/speed to count the duration, and the duration is different with each choices.

How to use a for loop then?

This article has been dead for over six months. Start a new discussion instead.