fork download
  1. #include <fstream>
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <conio.h>
  5.  
  6. using namespace std;
  7. void main()
  8. {
  9. ifstream inFile; //creates fstream object
  10. inFile.open("data.txt"); //opens data file
  11. ofstream outFile; //creates fstream object
  12. outFile.open("result.txt"); //opens output file
  13.  
  14. float celcius, fahrenheit; //input declarations
  15.  
  16. inFile >> celcius; //inputs data
  17.  
  18. while (inFile >> celcius);
  19. {
  20.  
  21. //fahrenheit calculations
  22. fahrenheit = celcius * 9 / 5 + 32;
  23. //output fahrenheit
  24. cout << "Fahrenheit of " << setprecision(5) << celcius << " is " << setprecision(5) << fahrenheit << endl; //visual feedback to see if the loop is working
  25.  
  26. outFile << fahrenheit; //prints fahrenheit to file
  27. }
  28. _getch(); //holding the console open for visual feedback
  29. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:4:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
stdout
Standard output is empty