# include & ltfstream & gt
Use namespace std
int main()
{
char a[][30]= { 0 };
int b[ 10]= { 0 };
int I = 0;
int m = 0;
ifstream in(" a . txt ");
If (! in.is_open())
{
Cout & lt& lt' cannot read the file';
}
And (! in.eof())
{
in.getline(a[i],30,' \ n ');
i++;
}
char * p = a[ 1];
int n = 0;
for(int j = 0; j & lt30; j++)
{
if(p[j] == ' ')
{
p[j]= ' \ 0 ';
b[m]= atoi(p+n);
m++;
n = j+ 1;
}
}
b[m]= atoi(p+n);
in . close();
System ("suspended");
Returns1;
}
The array b[ 10] contains {6, 2, 3, 13, 1, 0, 0}.
With this array, it's easy. If you don't want 6, just remove it.