Celsius temperatures into Farenheit

The prompt I was presented with is: Write a program that displays a table of the Celsius temperatures from 0 to 30 and their Fahrenheit equivalents.

I was not by a computer that had visual studio so I wrote it on codepad. I was able to create a working program on there, but when I tested it out in visual studio it will not even build.
I receive an error saying

(14): warning C4244: '=' : conversion from 'double' to 'float', possible loss of data

1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

1> fatal error LNK1120: 1 unresolved externals

I switched faren to double and that portion of the error message went away but it still will not build.

I am not sure why it will not build in visual studio (which is how it has to be submitted)
Any help would be greatly appreciated


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<iostream>
using namespace std;

int main()
{
   int i =0;
   int cels =0;
   float faren =0;

   cout<<"Celsius"<<" "<<"Farenhiet"<<endl;
   for(i=0;i<31;i++)
   {
       cels = i;
       faren = ((9.0/5.0)*cels + 32);
       cout<<cels<<"   "<< faren<<endl;
   }
   return 0;
}
Ran for me in VS2013

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<iostream>
using namespace std;

int main()
{
	int i = 0;
	int cels = 0;
	float faren = 0;

	cout << "Celsius" << " " << "Fahrenheit" << endl;
	for (i = 0; i<31; i++)
	{
		cels = i;
		faren = (float)((9.0 / 5.0)*cels + 32);
		cout << cels << "   " << faren << endl;
	}
	return 0;
}
Thank you very much I realized what I was doing wrong on the original post prior to seeing this, but thank you for the solution.
Topic archived. No new replies allowed.