Here is my code, I've been working on it for about 10 hours straight and haven't gotten any sleep and its due in about 3 hours. I'm starting to blank and I was wondering if anyone could possible help me write a code to find a grandTotal that equals the totalItemCost and the totalPotentialProfit for all items in the list. Thanks for any help!Code:#include <iostream> #include <fstream> #include <iomanip> #include <ios> #include <iosfwd> #include <iso646.h> #include <istream> #include <ostream> #include <sstream> #include <string> #include <strstream> using namespace std; void openTheFile(ifstream &myInFCB) { char filename[80]; cout<<"Input file name please! "; cin.getline(filename, '\n'); if (strcmp(filename,"")==0) return; myInFCB.open(filename); while (myInFCB.fail()) { myInFCB.clear(); cout<<"Is not a file name, please try again: "; cin.getline(filename, '\n'); myInFCB.open(filename); } } void printHeading(ofstream&goingAwayFile, int &k) { goingAwayFile << "Stock" << " " << "Description" << " " << "Total Item" << " " << "Total Potential" << " " << "Number of Items" << " " << endl; goingAwayFile << "Number" << " " << "of item" << " " << "cost" << " " << "Profit" << " " << "Needing Ordered" <<endl<<endl; k=0; } int multiply(int a, int b) { int c; c=0; c=a*b; return c; } float profitCounter(float c,float d, float f) { float e; e=0; e=(c-d)*f; return e; } int main() { ifstream inputFile; openTheFile(inputFile); ofstream outputFile; outputFile.open("funsies.txt"); char departmentCode[7]; char stockNumber[8]; char description[15]; float cost; float profit; float totalPotentialProfit; float itemsOrdered; float departmentTotal; float grandTotal; float totalItemCost; float sellPrice; int quantInStock; int quantLowLimit; int quantUpLimit; int subtotal; int lineCount; int swizzle; lineCount=0; subtotal=0; cost=0; profit=0; totalPotentialProfit=0; itemsOrdered=0; departmentTotal=0; grandTotal=0; totalItemCost=0; sellPrice=0; quantInStock=0; quantLowLimit=0; quantUpLimit=0; swizzle=0; char prevdept[7]; strcpy(prevdept,"WHY WON'T YOU WORK??????????????"); printHeading(outputFile, lineCount); while (!inputFile.eof()) { inputFile.get(departmentCode, 6); inputFile.ignore(1); inputFile.get(stockNumber, 6); inputFile.ignore(3); inputFile.get(description, 12); inputFile >> cost >> sellPrice >> quantInStock >> quantLowLimit >> quantUpLimit >> ws; lineCount++; if (lineCount%60==0) { outputFile << (char) 12 <<endl<< endl<<endl; printHeading(outputFile, lineCount); } grandTotal = totalPotentialProfit; totalItemCost = multiply(cost, quantInStock); totalPotentialProfit = profitCounter(sellPrice,cost,quantInStock); subtotal = totalItemCost + totalPotentialProfit; if (quantInStock < quantLowLimit) { itemsOrdered = quantUpLimit - quantInStock; } outputFile << setprecision(2) << right << fixed << stockNumber << " " << setw(12) << description << " " << setw(10) << totalItemCost << " " << setw(10) <<totalPotentialProfit << " "; if (quantInStock < quantLowLimit) { outputFile << setprecision(0) << itemsOrdered; } //outputFile << "The value of prevdept is: " << prevdept << " and departmentCode was: " << departmentCode << endl; cout << "prevdept equals: " << prevdept << "departmentCode equals: " << departmentCode <<endl; if (strcmp(departmentCode, prevdept)!=0)// && strcmp(prevdept, "WHY WON'T YOU WORK??????????????")==1) { outputFile <<endl << "Department subtotal" << endl << subtotal <<endl; strcpy(prevdept, departmentCode); } outputFile << endl; } outputFile << setprecision(2) << "Grand Total" << endl << grandTotal; inputFile.close(); outputFile.close(); }