My problem is when I type my 1st file name it displays the data in the file as integer and display the standard deviation as integer also.(This one is okay)
Then the 2nd data file input comes in and display the data as integer and display the standard deviation with decimal point.
My main problem starts after the 2nd data input when I type in my 3rd data input and the displayed data comes out with decimal point and also my standards deviation, when it should display only 4 but it display 4.0 .
Can someone tell me my problem or is it a limitation?
The solution is to cast the output as int. cout << (int) array [counter] <<" ";
and cout << "The Standard Deviation is :" << (int) sdfloat << " ";
The real problem with your code is that, once it has passed cout.precision(1);, every subsequent output of numbers has precision 1.
(Even if it is in a while loop and the program returns to the beginning of that loop, the precision stays set at 1 for every loop. Meaning integers and floating points.) Unless of course you set it back to cout.precision(0);. You can do this either at the start or at the very end of the while (response=='y'||response=='Y')-loop.