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 (celcius != -999);
  19. {
  20.  
  21. inFile >> celcius;
  22. //fahrenheit calculations
  23. fahrenheit = celcius * 9 / 5 + 32;
  24. //output fahrenheit
  25. cout << "Fahrenheit of " << setprecision(5) << celcius << " is " << setprecision(5) << fahrenheit << endl;
  26.  
  27.  
  28.  
  29. outFile << fahrenheit; //prints fshrenheit to file
  30. }
  31. }
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