I'll say thanks in advance for any who take the time to glance at this for me.
I've a very basic data import from my file: test2.dat. The import appears to work fine and does display the data correctly, but upon sorting, I'm not getting anything but an output in the original order. I had my prof look at it and he didn't see anything obvious (then again, his eyesight is poor and he has a ton of students to assist). All I'm hoping for is a hint, even if it's just to say I coded it wrong.
Here's the code followed by the dat file contents:
int main()
{
int y,x,kount=0;
string item_name[100],item_color[100],temp_in,temp_ic;
double item_weight[100],temp_iw,total_weight=0,av_weight=0;
cout<<"Data retrieval program PD(2011)\n\n";
cout<<"This program will retrieve component data from the file test2.dat,\n";
cout<<"display the pre-sorted data and then display the data sorted by weight\n";
cout<<"from smallest to largest. The program will also display the sum of all\n";
cout<<"item weights and the calculation of average weight per item.\n\n";
cout<<"\n\nTotal weight of gruppo: \t"<<total_weight<<" grams\n";
av_weight=total_weight/(kount+1);
cout<<"Average weight per component: \t"<<setprecision(3)<<av_weight <<" grams\n";
cout<<"\n\nThank you for using my data retrieval program!"<<"\n";
cout<<"Press ENTER to continue...";
cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
return EXIT_SUCCESS;
}
/* dat file contents:
72 carbon f_derailleur
155 carbon r_derailleur
272 carbon brake_calipers
680 black_carbon crankset
29.25 natural bottom_bracket
98 red headset
248 titanium saddle
250 aluminum seatpost
260 carbon handlebar
130 black stem
52.5 black bottle_cages
248 black pedals
10.45 steel cables
88 yellow tubes
3.12 graphite brake_pads
11 speckled bar_tape
10 red computer
1675 anthracite frame
24 red bottles
590 red f_wheel
800 red r_wheel
235 grey f_tire
235 grey r_tire
117 titaium cassette
239 black chain