Don't use
#import
. This is not standard C++, and will be treated differently by different compilers. Microsoft uses it to indicate that the included file is a type library, while gcc will pretend the included file has include guards.† The standard library will always have include guards, so just use#include
in this case.Your
COLUMN_SEPARATOR
uses a\t
for alignment, which explains the wonky third line. It would be better to usestd::setw
from<iomanip>
here:std::cout << std::setw(10) << i << COLUMN_SEPARATOR << std::setw(10) << toFahrenheit(i) << std::endl;
If you're feeling ambitious, you can try overloading the
<<
operator, as suggested in this SO answer overloading the<<
operator, as suggested in this SO answer.
† That is to say, it will include the file at most once.
Don't use
#import
. This is not standard C++, and will be treated differently by different compilers. Microsoft uses it to indicate that the included file is a type library, while gcc will pretend the included file has include guards.† The standard library will always have include guards, so just use#include
in this case.Your
COLUMN_SEPARATOR
uses a\t
for alignment, which explains the wonky third line. It would be better to usestd::setw
from<iomanip>
here:std::cout << std::setw(10) << i << COLUMN_SEPARATOR << std::setw(10) << toFahrenheit(i) << std::endl;
If you're feeling ambitious, you can try overloading the
<<
operator, as suggested in this SO answer.
† That is to say, it will include the file at most once.
Don't use
#import
. This is not standard C++, and will be treated differently by different compilers. Microsoft uses it to indicate that the included file is a type library, while gcc will pretend the included file has include guards.† The standard library will always have include guards, so just use#include
in this case.Your
COLUMN_SEPARATOR
uses a\t
for alignment, which explains the wonky third line. It would be better to usestd::setw
from<iomanip>
here:std::cout << std::setw(10) << i << COLUMN_SEPARATOR << std::setw(10) << toFahrenheit(i) << std::endl;
If you're feeling ambitious, you can try overloading the
<<
operator, as suggested in this SO answer.
† That is to say, it will include the file at most once.
Don't use
#import
. This is not standard C++, and will be treated differently by different compilers. Microsoft uses it to indicate that the included file is a type library, while gcc will pretend the included file has include guards.† The standard library will always have include guards, so just use#include
in this case.Your
COLUMN_SEPARATOR
uses a\t
for alignment, which explains the wonky third line. It would be better to usestd::setw
from<iomanip>
here:std::cout << std::setw(10) << i << COLUMN_SEPARATOR << std::setw(10) << toFahrenheit(i) << std::endl;
If you're feeling ambitious, you can try overloading the
<<
operator, as suggested in this SO answer.
† That is to say, it will include the file at most once.