Yes - your data structures. If you include the arrays within the structure, then you don't need an array of BorData. You have eitherany suggestions as to what I'm doing wrong here...
1)
or 2)Code:struct BorData { string borough[5]={"New York City","Bronx","Queens","Brooklyn","Manhattan"}; int accidents[5]; }; ... BorData combine;
Which way you choose then determines how you use the data.Code:struct BorData { string borough; int accident; }; ... BorData combine[5] = {{"New York City", 0}, {"Bronx", 0}, {"Queens", 0}, {"Brooklyn", 0}, {"Manhattan", 0}};
for 1)
for 2)Code:for (int i = 0; i < 5; i++) { cout "..... " << combine.borough[i]; cin >> combine.accidents[i]; }
Code:for (int i = 0; i < 5; i++) { cout "..... " << combine[i].borough; cin >> combine[i].accidents; }




Reply With Quote
