I'm starting to learn cpp and am trying some of the cpp questions on hackerrank.com as a practice but I'm not using their compiler but I'm using visual studio 2019.
The issue is 19856.992
is printing as 19857
and -5279235.721231465
as -5.27924e+06
.
Code:
#include<iostream>
int main() {
int intVal;
long long int LongIntVal;
char CharVal;
float FloatVal ;
double DoubleVal;
std::cout << "input: ";
std::cin >> intVal >>LongIntVal>>CharVal>>FloatVal>>DoubleVal;
std::cout << std::endl << intVal << std::endl << LongIntVal << std::endl<< CharVal << std::endl << FloatVal << std::endl << DoubleVal;
return 0;
}
output:
input: 211916801 97592151379235457 p 19856.992 -5279235.721231465
211916801
97592151379235457
p
19857
-5.27924e+06