problem in cout array

hi all
why second array cout incorrect
i like to cout like this
1
2
3
4
5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  #include <iostream>
using namespace std;
main ()
{
	int d[31],m,x=0,y,z,s[100];
	for(int i=0;i<=5;i++){
	cin>>s[i];
	x++;
	for(m=0;m<=i;m++)
	d[m]=x;
}
for(int i=0;i<=5;i++)
	cout<<s[i]<<"  "<<d[m]<<endl;
}

thanks
Last edited on
Check the value of m after line 10.
Topic archived. No new replies allowed.