/* program prob2 - illustrate set width and precision * create a table to evaluate a formula result = f(gpa) */ #include using namespace std; int main() { double gpa,result; cout.setf(ios::fixed,ios::floatfield); cout.precision(2); //set decimal precision cout << "\t\t\tTable of Function Values" << endl << endl; cout << "Grade Point Average\tValue of Formula\tStatus" << endl; for (gpa = 0.00; gpa <= 4.00; gpa = gpa + 0.50) { result=(gpa*gpa*gpa+7*gpa-1)/(gpa*gpa - (gpa+5)/3); cout.width(19); cout << gpa; cout.width(21); cout << result; if (result >= 0) cout << "\tAdmit"; cout << endl; } cout << endl << "The table is finished" << endl; // system("pause"); //un-comment when using DevC++ return 0; }