My for loop (for debugging) for a capitalism simulator I'm making is not working, as it is exiting at ix=0 (it only executes the loop body once). I also believe it is syntactially correct (from other questions).
Here is my code (I left out the variables):
void print_things(String2Double b, String2Double up_cost, String2Double tFinish, string* bNames) {
// Just for debugging!
for (int ix=0;ix<(sizeof(bNames)/sizeof(bNames[0]));ix++) {
cout << "Count of business " << bNames[ix] << ": " << b[bNames[ix]] << endl;
cout << "Upgrade cost for " << bNames[ix] << ": " << up_cost[bNames[ix]] << endl;
cout << "Time to finish for " << bNames[ix] << ": " << tFinish[bNames[ix]] << endl;
cout << ix << endl;
}
}
I also had it print the size of bNames[]
, which is 9 and it only printed ix=0,
and I suspected something must be wrong.
Thank you!