Hi,
Im trying to write the output from each function all to the same file "PROCOUT.DAT" but it will only write the last function to the file.
The functions are A through F but i only posted A and F so it would be shorter. But the output file only shows the last function F. If I change them from writing to the file to cout, then they all show up fine.Code:#include <iostream> #include <string> #include <cmath> #include <fstream> #include <iomanip> using namespace std; void GETA(float); void GETB(float); void GETC(float); void GETD(float); void GETE(float); void GETF(float); void main() { float VALUEA; VALUEA = 0; GETA(VALUEA); float(VALUEF); VALUEF = 0; GETF(VALUEF); } void GETA(float AVALUE) { ifstream FILEIN; ofstream FILEOUT; FILEIN.open("A:DATFILE1.txt"); FILEOUT.open("A:PROCOUT.DAT"); FILEIN >> AVALUE; FILEOUT << "A.) "; while(FILEIN) { FILEOUT << AVALUE << ' '; FILEIN >> AVALUE; } FILEOUT << endl; FILEIN.close(); FILEIN.clear(); } void GETF(float FVALUE) { ifstream FILEIN; ofstream FILEOUT; FILEIN.open("A:DATFILE1.txt"); FILEOUT.open("A:PROCOUT.DAT"); float NUM1; NUM1 = 0; float NUM2; NUM2 = 0; FILEIN >> NUM1; while(FILEIN) { FILEIN >> NUM1; if(abs(NUM1-200)==33) NUM2 = NUM1; } FILEOUT << endl << "F.) " << NUM2 << endl; FILEIN.close(); FILEIN.clear(); }
i use microsoft visual studio.net 2003.
Thanks



LinkBack URL
About LinkBacks


