help me please

#include <iostream>
using namespace std;
int main()
{
const int n=7;
float iarray[n];
float dable;
cout<<"enter values for your array"<<endl;
for(int i=0;i<1;i++)
{
cout<<"for element:"<<i<<endl;
cin>>iarray[i];
dable=iarray[i*2];
}
cout<<"these are the value in your array"<<endl;
for(int i=0;i<n;i++)
{
cout<<dable<<" ";
}
cout<<endl;

system("pause");
return 0;
}


when the output is show and i enter number 2 is become 2222222
HOW COME i dont understand the output,,helppp mee
closed account (28poGNh0)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# include <iostream>
# include <limits.h>// For INT_MAX
using namespace std;

int main()
{
    const int n=7;
    float iarray[n];

    cout << "Enter values for your array " << endl;

    for(int i=0;i<n;i++)
    {
        cout << "For element:" << i << endl;
        cin >> iarray[i];
    }

    cout << endl << "These are the value in your array" << endl;
    for(int i=0;i<n;i++)
        cout << iarray[i] << " ";

    cout << endl;

    cin.ignore(INT_MAX,'\n');

    return 0;
}



how can you put 2 and your program between 0 to 1 !!

1
2
3
4
5
6
7
for(int i=0;i<1;i++)
{
cout<<"for element:"<<i<<endl;
cin>>iarray[i];
dable=iarray[i*2];
}
Topic archived. No new replies allowed.