All pastes #354922 Raw Edit

Someone

public cpp v1 · immutable
·published 2007-02-14 06:09 UTC
rendered paste body
/***************************SKELETON SPEC SHEET Nick Buccinno 2007**************************INPUT INFO					prog2.txtOUTPUT INFO	convOut.txtCONSTANTSnoneCONSTRAINTS		noneOPERATIONS 1. Open ofstream2a. Reference input file2b. If cannot be opened, display error3a. Reference output file3b. If it cannot be opened, display error4. Determine conversion type using char input5. Determine amount using int input 6. Convert7. Store to output file8. Format and display on screen9. Check for EOF10. End*/#include <iostream>		// for cin, cout#include <fstream>		// for ifstream and ofstream#include <string>		// for string class#include <conio.h>		// for getch()#include <stdio.h>#include <iomanip>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;}