The program specifies a one-dimensional array, the numbers of which are generated arbitrarily,
you need to organize its output using cout. But with this output:
cout & lt; & lt; m [i]; //without spaces
The number is displayed without spaces, i.e. solid numbers
54216452122454235412
How to make such a conclusion
54 21 64 52 12 24 54 23 54 12
Answer 1, authority 100%
So:
cout & lt; & lt; m [i] & lt; & lt; '';
printf -not suitable
Why? Can’t you use it or did you make such a conclusion yourself? Otherwise, you can do this:
printf ("% i", m [i]);
Answer 2, authority 98%
eg
cout & lt; & lt; m [i] & lt; & lt; "";
Answer 3, authority 67%
# include & lt; iterator & gt;
#include & lt; algorithm & gt;
#include & lt; iostream & gt;
using namespace std;
...
copy (m, m + sizeof (m) / sizeof (m [0]), ostream_iterator & lt; int & gt; (cout, ""));
cout & lt; & lt; endl;
Answer 4, authority 67%
Including the library
# include & lt; iomanip & gt;
further when outputting an array:
cout & lt; & lt; m [i] & lt; & lt; setw (5);
The setw
function makes spaces between elements by the number of units indicated in parentheses.
Answer 5, authority 33%
cout & lt; & lt; m [0];
for (int i = 1; i & lt; sizeof m / sizeof (int);) cout & lt; & lt; & lt; & lt; m [i ++];
cout & lt; & lt; endl;
Answer 6
# include & lt; iostream & gt;
usin namespace std;
int main () {
int a [1024];
for (int i = 0; i & lt; = 1024; i ++)
a [i] = i;
for (int i = 0; i & lt; = 1024; i ++)
cout & lt; & lt; a [i] & lt; & lt; ''; // well, or printf ("% d", a [i]);
}