I have written a simple program to output different temperature units using conversions given. When I run the code on Visual Studios, it won't run due to build errors but no errors are shown. I have seen similar questions asked but couldn't really see any answer that solved my issue. I was also wondering whether I should be declaring the variables before or after the main function.
#include <iostream>
using namespace std;
int fahrenheit, i=0;
float celsius, absolute_value;
main() {
cout.width(20);
cout << "Fahrenheit" << "Celsius" << "Absolute value\n";
for (i = 0; i = 15; i += 1) {
fahrenheit = i * 20;
celsius = ((fahrenheit - 30) * 5) / 9;
absolute_value = celsius + 273.15;
cout.width(20); /*each item in next output will have width of at least 20*/
cout << fahrenheit << celsius << absolute_value;
}
system("pause");
return 0;
}