Floor/Ceiling (Temp Table) Question

I am trying to write a program to output the following table using floor and ceiling, however, for some reason my professor decided not to teach it. I need it to be read from an input file. Any help would be greatly appreciated, my code that I have so far is at the bottom. Thanks!!!
Sample Input
50 54
210 215
1 0


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
Expected Output 
Table 1: 50 to 54 degrees Fahrenheit 
Fahrenheit  Centigrade 
        50          10 
        51 
                    11 
        52 
        53 
                    12 
        54  
 
Table 2: 210 to 215 degrees Fahrenheit 
Fahrenheit  Centigrade 
----------  ---------- 
       210 
                   99 
       211 
       212         100 
       213 
                   101 
       214 
       215 




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>		// cout
#include <fstream>		// ifstream, ofstream
using namespace std;

		void main ()
		{
			ifstream fin;       //declare an input_stream_name
			ofstream fout;       //declare an output_stream_name
		double fah1, fah2;		

			fin.open (“E:/a1q2dat.txt”);  //open the input file
			fout.open (“E:/output.txt”); //create the output file
			//include the directory or remove it 

			int cel1=(5/9)*(fah1-32);
Last edited on
main must return int
(5/9)*(fah1-32); Integer division returns an integer (in this case 0). Use floats.
Also, fah1 was not initialised.

http://www.cplusplus.com/reference/clibrary/cmath/floor/
http://www.cplusplus.com/reference/clibrary/cmath/ceil/
Topic archived. No new replies allowed.