I'm trying to find the grand total from two totals inside a loop. I'm getting some crazy numbers. Any help would be great. Thanks.
Code:
installCost = yards * 5;
carpCost = yards * carpPrice;
totalCost = installCost + padCost + carpCost;
//Calculate Grand Totals
//yards = totalYards;
// totalInstall = installCost;
// totalPad = padCost;
// totalCarp = carpCost;
// grandTotal = totalCost;
totalYards += yards;
totalInstall += installCost;
totalPad += padCost;
totalCarp += carpCost;
grandTotal += totalCost;
//Display output
cout << "Room " << roomCount << " installation = $" << installCost << endl;
cout << "Room " << roomCount << " Padding Cost = $" << padCost << endl;
cout << "Room " << roomCount << " Carpet Cost = $" << carpCost << endl;
cout << "Room " << roomCount << " Total Cost = $" << totalCost << endl;
}
//Display Grand Totals
cout << "For " << rooms << " rooms: " << endl;
cout << "Total square yards required: " << totalYards << endl;
cout << "Total installation: $" << totalInstall << endl;
cout << "Total padding: $" << totalPad << endl;
cout << "Total carpeting: $" << totalCarp << endl;
cout << "Grand Total: $" << grandTotal << endl;