#include #include #include #include #include #include using namespace std; int main() { ifstream In; ofstream Out; In.open("expgrowin.txt"); Out.open("expgrowout.txt"); if (In.fail()) { cout << "Input file not found: " << In << endl; cout << "Existing..." << endl; return EXIT_FAILURE; } double Reserve, Rate, aGR, resHalf, resOut; In.ignore(INT_MAX, '\n'); In >> Reserve >> Rate; In.ignore(INT_MAX, '\n'); In.ignore(INT_MAX, '\n'); Out << "Programmer: Kyle Kim" << endl << "Exponential Growth and Decay" << endl << endl << " Initial Data" << endl << "Reserve:\t" << Reserve << endl << "Rate:\t\t" << Rate << endl << endl << " AGR Time100 Time50" << endl << setfill('-') << setw(30) << "-" << endl << setfill(' '); while ( In ) { In >> aGR; In.ignore(256, '\n'); resOut = (1.0/aGR) * log(((aGR * Reserve)/Rate) + 1.0); resHalf = (1.0/aGR) * log(((aGR * Reserve)/(2.0 * Rate)) + 1.0); Out << setw(5) << aGR << setw(10) << resOut << setw(10) << resHalf << endl; } Out << setfill('-') << setw(30) << "-" << endl << setfill(' '); In.clear(); In.close(); Out.close(); return 0; }