first loop iterates through data by the day of an input file: outputs to a diff file
second loop iterates through the trucks in input file:also outputs answer
my question is this, i don't want to use vector for second loop, so how can i make a loop with this exact variable without using vectors?
i have tried so many things but it keeps saying: "truckWeight can't be used as function
1 2 3 4 5 6 7 8 9 10
//for loop for day
for (d = 0; d < 7; d++){
outFile << "Statistics for " << dayOfWeek[d]<< ":" << endl;
outFile << "Trucks with Fines: " << endl;
//for loop for truck
for (t = 0; t < truckWeight; t++) {
currentTruckWeight = truckWeight(t).at(d);
}
i don't want to use a vector b/c i've been putting it inside another vector, and i don't want it that messy, so i changed truckWeight into int so that i can make it easier for me to understand my own program, however truckWeight(t).at(d) is what it looked like before i turned it into int
LOL! Ok... so, what you need is a 2D-array to store truck weights? How many trucks do you have? Is it a number known at compilation time? If so, let's say this is constint truck_count=50; //or anything you want... , you can declare a 2D-array for your problem like this: int truck_weight[7][truck_count]; (7 days, truck_count trucks, for a total of 7*truck_count ints in your array)