int to double

Im almost done with this program but encountered a problem :(
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

using namespace std;

int main()
{
	double *dp[10];
	for ( int i = 0; i < 10; i++){	
	dp[i] = new double();	
	cout << '[';
	*dp[i] = 0.0;
	cout << *dp[i];
	cout << ']' << endl;
}

return 0; 
}


produces:
1
2
3
4
5
6
7
8
9
10
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]


but i want it to come out as:
1
2
3
4
5
6
7
8
9
10
[0.0]
[0.0]
[0.0]
[0.0]
[0.0]
[0.0]
[0.0]
[0.0]
[0.0]
[0.0]


Last edited on
You manipulators:
cout << fixed << setprecision(1) << *dp[i];
http://www.cplusplus.com/reference/iostream/manipulators/
Awesome thank you :)
Topic archived. No new replies allowed.