My code reads data of a text file. I am suppose to have do the calculations and have it save to an output file with proper alignment ( left justified, center and right justified)
/*this is an array!*/
string item[10] = {" "}; //ten items
double total[10] = {0.0}; //ten totals
double quantity[10]= {0}; //ten quantity
int i = 0;
double grandtotal = double();
double totalinv= double();
ifstream in;
in.open("input.txt");//opening file later
if(in.fail()) //checking for error in file as in no file found
cout << "file doest work";
if(in.bad()) //checking if file is corrupt
cout << "not found";
while(!in.eof()) //while the file is not done
{
in >> item[i] >> quantity[i] >> total[i];
grandtotal= quantity[i] * total[i]; //calculates the total for the specific product
totalinv += grandtotal; // adds up all the totals
i++;