Почему я получаю целое число, а не двойное значение, если начальное значение равно двойному? [дубликат] ⇐ C++
Почему я получаю целое число, а не двойное значение, если начальное значение равно двойному? [дубликат]
I am wondering if anyone could help me understand why I am getting an int here and not a double? My guess is it probably due to the fact the decimal part is just .00 but how can I make sure it writes it anyway. Thanks!
#include #include #include using namespace std; int main() { // initalize variables string dataLine; string stationName; string substringMaxTemp; string substringLowTemp; int positionMaxTemp; int positionLowTemp; double maxTemp = 0.0; double minTemp = 99.9; int positionStationName = 0; ifstream inputFile; // open the input file (program expects the file to be in the same directory // as the program) inputFile.open("reduced_columns(2).txt"); // check if the file is successfully opened if (!inputFile) { cout
Источник: https://stackoverflow.com/questions/781 ... is-a-doubl
I am wondering if anyone could help me understand why I am getting an int here and not a double? My guess is it probably due to the fact the decimal part is just .00 but how can I make sure it writes it anyway. Thanks!
#include #include #include using namespace std; int main() { // initalize variables string dataLine; string stationName; string substringMaxTemp; string substringLowTemp; int positionMaxTemp; int positionLowTemp; double maxTemp = 0.0; double minTemp = 99.9; int positionStationName = 0; ifstream inputFile; // open the input file (program expects the file to be in the same directory // as the program) inputFile.open("reduced_columns(2).txt"); // check if the file is successfully opened if (!inputFile) { cout
Источник: https://stackoverflow.com/questions/781 ... is-a-doubl
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Ошибка API критериев: оператор не существует: целое число = целое число []
Anonymous » » в форуме JAVA - 0 Ответы
- 61 Просмотры
-
Последнее сообщение Anonymous
-