/* ************************** SKELETON SPEC SHEET Nick Buccinno 2007 ************************** INPUT INFO prog2.txt OUTPUT INFO convOut.txt CONSTANTS none CONSTRAINTS none OPERATIONS 1. Open ofstream 2a. Reference input file 2b. If cannot be opened, display error 3a. Reference output file 3b. If it cannot be opened, display error 4. Determine conversion type using char input 5. Determine amount using int input 6. Convert 7. Store to output file 8. Format and display on screen 9. Check for EOF 10. End */ #include // for cin, cout #include // for ifstream and ofstream #include // for string class #include // for getch() #include #include using namespace std; int main() { char convType, dummy; int temp; int convFar; int convCel; ifstream convIn; convIn.open("prog2.txt", ifstream::in); if (convIn.good()) { ofstream convOut; convOut.open("output.txt", ofstream::out); if (convOut.good()) { convType = convIn.get(); if (convType == 'F') { dummy = convIn.get(); temp = convIn.get(); convCel = (temp * 9) / 5 + 32; convOut << temp; convOut << setprecision(2) << fixed << temp << " " << convCel << endl; } else if (convType == 'C') { dummy = convIn.get(); temp = convIn.get(); convFar = (temp - 32) / 9 * 5; convOut << temp; convOut << setprecision(2) << fixed << temp << " " << convFar << endl; } else { cout << "Error, wrong input type detected! "; getch(); } } else { cout << "Error opening output"; getch(); } } else { cout << "Error opening input"; getch(); } cout << "Successful Run"; getch(); return 0; }