<edit>
i gave old code by accident. here is the actual code
</edit>
here is the code i am concerned with. the formatted output looks like it is correct after you run the program, but i don't know if this is how it should be done. i was getting a few warning messages so i thought i would ask the experts. i also attached a zip file with the entire program and input/output files.
Code:
//Print heading to log file program5.out
fout<<STARS<<endl;
fout<<setw(40-storeName.length())<<storeName<<endl;
fout<<STARS<<endl;
fout<<"Product Code Description Unit Price"<<endl;
fout<<"************ ************************* **********"<<endl;
fout<<setiosflags(ios::fixed|ios::showpoint)<<setprecision(2);
//Format file output with setw and length
fout<<setw(5)<<productCode<<setw(14-productCode.length()+descriptions[index].length())<<descriptions[index]<<setw(42-descriptions[index].length())<<price[index]<<endl;
}
else
{
cout<<"***ERROR: PRODUCT CODE "<<productCode<<" is not in list."<<endl;
fout<<setw(5)<<productCode<<" Invalid Product Code"<<endl;
}
i put the heading code there so you could get an idea of what i am trying to get the output to look like. if you don't understand you could just run the program i attached and see what i am trying to do. like i said...the way i did it looks right, but i'm not sure if it is because of warning messages. any help is greatly appreciated.