Hello Dominick55,
To start with:
1 2 3 4 5 6 7 8 9
|
#include<iostream>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<string>
#include<cstdio> // <--- Unless you are using C input/output this is not needed.
#include<cstdlib> // <--- Had an exrta > at the end.
using namespace std; // <--- Bad idea/ You should learn not to use this.
|
In the function "myf2c" the calculation to the right of the = is done as a double or at least a float, but the result is stored in an int loosing the decimial portion of the double unless that is what you want.
The same applies to "myctof".
Small warnings, but something to think about.
Line 68: I would put this line in the "MyMenu" function and also validate the input to make sure that a valid number is input. Easier to do this in the "MyMenu"function and return a good number back to main than to tell the user in main and not have a good recovery. Looks like what you have does work.
Lines 80 and 81, 94 and 95, 138 and 139 and 151 and 152 it would be better to open these files outside of the while loop and to do a check to make sure they are open. Also better to have names like "inFile" and "Outfile" to keep them straight. Then close these files just before the program ends. The other problem is each time through the while loops when you open the input file you will only read the first temp in the file missing all the rest.
Each time you open the file for output you are printing the "c" that you converted followed by 10 hard coded outputs. Not what you want. It should contiue to read the input file for the next temp and output the conversion. It is not.
That takes cre of "input == 1". The same can be applied to "input == 2".
Now I have to create an input file and work on adjusting the program.
Hope that helps,
Andy